Я пытаюсь использовать WCF с федерацией.Поэтому мой клиент получает токен от STS, открывает канал с выданным токеном и, наконец, вызывает сервис.
Затем я получаю следующее исключение:
System.NotSupportedException
HResult=0x80131515
Message=Crypto algorithm not supported in this context.
Source=mscorlib
StackTrace:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at FederatedClientForWCF.MySomeService.ISomeService.Revert(String text)
at FederatedClientForWCF.Program.Main(String[] args) in D:\Spikes\FederatedClientForWCF\FederatedClientForWCF\Program.cs:line 81
Обратите внимание, что имя алгоритма отсутствует.
Вот мой код клиента (без подробностейполучения токена):
// get the token
var token = RequestTrustToken();
// setup the binding
var binding = new CustomBinding(
SymmetricSecurityBindingElement.CreateIssuedTokenBindingElement(
new IssuedSecurityTokenParameters("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1")),
new TextMessageEncodingBindingElement(),
new HttpTransportBindingElement());
// explicitely use relative fed-endpoint
var endpointAddress = new EndpointAddress("http://localhost:53279/service/someservice/fed");
// build the factory
var factory = new ChannelFactory<ISomeService>(binding, endpointAddress);
factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
factory.Credentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
factory.Credentials.SupportInteractive = false;
// create channel
var channel = factory.CreateChannelWithIssuedToken(token);
// try it
var reverted = channel.Revert(helloWorld);
На стороне службы конфигурация службы выглядит следующим образом, я пропустил конфигурацию идентификации, но при необходимости могу опубликовать ее:
<!-- Der Service der gehostet wird. -->
<service name="SomeService.SomeService" behaviorConfiguration="SomeServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:53279/service/someservice"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="SomeService.Contract.ISomeService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="fed" binding="customBinding" bindingConfiguration="federatedBinding" contract="SomeService.Contract.ISomeService" />
</service>
</services>
<bindings>
<customBinding>
<binding name="federatedBinding">
<security authenticationMode="IssuedToken">
<issuedTokenParameters tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1" keyType="SymmetricKey" />
</security>
<textMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="SomeServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials useIdentityConfiguration="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Что означает исключение?Я пропускаю криптоалгоритм где-нибудь?