Tôi có dịch vụ WCF phát hành mã thông báo đang sử dụng Microsoft.IdentityModel (WIF 3.5) mà tôi cần nâng cấp lên System.IdentityModel (.NET 4.5) . Vấn đề là tôi không thể thay đổi tên gốc của dịch vụ, Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceContract
, thành đối tác mới hơn, System.ServiceModel.Security.WSTrustServiceContract
. Đối với một số lý do nó không được công nhận bởi IntelliSense:Không thể giải quyết/sử dụng System.ServiceModel.Security.WSTrustServiceContract làm tên dịch vụ
Các màu xanh nguệch ngoạc dòng lỗi là:
The 'name' attribute is invalid - The value 'System.ServiceModel.Security.WSTrustServiceContract' is invalid according to its datatype 'serviceNameType'
tôi có tài liệu tham khảo lắp ráp để System.ServiceModel
và System.IdentityModel
trong <assemblies>
nút.
Ngay cả khi tôi bỏ qua những lỗi IntelliSense và chạy các dịch vụ và truy cập nó sử dụng trình duyệt Tôi nhận được lỗi metadata này:
Metadata publishing for this service is currently disabled.
Metadata xuất bản là kích hoạt vì vậy tôi nghĩ rằng đó là vì vấn đề tên của dịch vụ.
Ngoài ra tôi nhận được lỗi này từ VS.NET khách hàng kiểm tra WCF:
Error: Cannot obtain Metadata from http://localhost:49178/Services/Issuer.svc
If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
URI: http://localhost:49178/Services/Issuer.svc
Metadata contains a reference that cannot be resolved: 'http://localhost:49178/Services/Issuer.svc'.
There was no endpoint listening at http://localhost:49178/Services/Issuer.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found.
HTTP GET Error
URI: http://localhost:49178/Services/Issuer.svc
The HTML document does not contain Web service discovery information.
Tôi nghĩ rằng "Metadata contains a reference that cannot be resolved
" dòng cũng đề cập đến tên dịch vụ quyết lỗi.
Mọi ý tưởng về những việc cần làm ở đây? Tôi đánh giá cao bất kỳ sự giúp đỡ ..
Issuer.svc:
<%@ ServiceHost Language="C#" Debug="true" Factory="Identity.Services.Wcf.Core.CustomSecurityTokenServiceContractFactory" Service="CustomSecurityTokenServiceConfiguration" %>
Factory:
public class CustomSecurityTokenServiceContractFactory : WSTrustServiceHostFactory
..
dịch vụ:
public class CustomSecurityTokenServiceConfiguration : SecurityTokenServiceConfiguration
..
Bạn đã làm theo hướng dẫn tại [link] (https://docs.microsoft.com/en-us/dotnet/framework/security/guidelines-for-migrating-an-application-built-using-wif-3 -5-to-wif-4-5) –
@SamuelShyu: vâng tôi đã làm. Tài liệu chỉ đề cập đến những thay đổi không gian tên, không có gì giống như thay đổi hành vi. Tôi thậm chí còn giải mã cả Microsoft.Identity. * Và System.Identity. * Các lớp và chúng giống hệt nhau. – dstr
Hãy thử với gợi ý ở điểm 4 của câu trả lời của tôi: Nhấp vào "Nâng cao" và bỏ chọn "Sử dụng lại các loại trong hội đồng được tham chiếu" khi bạn tạo proxy. – Isma