我試圖放在一起聲稱感知WCF服務和客戶端。無法序列化Saml2AssertionKeyIdentifierClause
我使用的thinktecture Identity Server,我已經通過看「用令牌與WCF/SOAP」例如把一個控制檯客戶端:
var token = GetSecurityToken();
var binding =
new WS2007FederationHttpBinding(
WSFederationHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Message.EstablishSecurityContext = false;
var factory =
new ChannelFactory<IService1>(
binding,
new EndpointAddress("https://localhost:44301/Service1.svc"));
factory.Credentials.SupportInteractive = false;
factory.ConfigureChannelFactory();
var service = factory.CreateChannelWithIssuedToken(token);
var result = service.GetData(42);
我有(什麼樣子)一來自STS的有效令牌。
然而,它拋出在調用GetData
異常,如下所示:
有序列化的安全密鑰標識符錯誤。有關更多詳細信息,請參閱 內部例外。
內部異常如下:
令牌串行不能序列 'System.IdentityModel.Tokens.Saml2AssertionKeyIdentifierClause'。 如果這是自定義類型,則必須提供自定義序列化程序。
我能找到的唯一提到的這個問題是this one on the MSDN forums,但這只是稍有關係。
在調試器中看來,端點行爲似乎包含(最終)Saml2SecurityTokenHandler,而其他鏈接暗示的是所有需要的。
我錯過了什麼?
如何將我的答案標記爲接受的答案? –
因爲我不在一個地方去驗證你的答案是否真的有效...... –