Answer the question
In order to leave comments, you need to log in
Connecting to a WCF service, Security block. What is the problem?
Good day to all. I'm trying to connect to a WCF service using the WS-Security standard. A certificate is used to sign requests:
<clientCredentials>
<clientCertificate x509FindType="FindBySubjectName"
storeLocation="CurrentUser"
storeName="My"
findValue="Тестовый НБКИ - 2016-07"/>
<serviceCertificate>
<authentication certificateValidationMode="None" />
</serviceCertificate>
</clientCredentials>
<endpoint address="https://ips.rosminzdrav.ru/5358bf30e7897"
behaviorConfiguration="ipsErBeh" binding="wsHttpBinding" bindingConfiguration="newBinding"
contract="ipsWorkMisService.misInterface" name="ipsWorkEndPoint"/>
<wsHttpBinding>
<binding name="newBinding" maxReceivedMessageSize="2147483647"
messageEncoding="Text">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
ipsWorkMisService.misInterfaceClient ms = new misInterfaceClient("ipsWorkEndPoint");
if (security != null)
{
X509SecurityTokenParameters tokenParameters = new X509SecurityTokenParameters();
tokenParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient;
tokenParameters.RequireDerivedKeys = false;
security.EndpointSupportingTokenParameters.SignedEncrypted.Add(tokenParameters);
security.EndpointSupportingTokenParameters.SignedEncrypted.Add(new UserNameSecurityTokenParameters());
}
ms.Endpoint.Binding = new CustomBinding(elements.ToArray());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question