Minimal client that supports messaging security over the channel interface

I am trying to create a minimal client for a WCF service using WSHttpBinding with SecurityMode: Messagea direct channel interface.

My current code is very simple:

EndpointIdentity i = EndpointIdentity.CreateX509CertificateIdentity(clientCertificate);
EndpointAddress a = new EndpointAddress(new Uri("http://myServerUrl"), i);
WSHttpBinding b= new WSHttpBinding(SecurityMode.Message);
ChannelFactory<IRequestChannel> channelFactory = new ChannelFactory<IRequestChannel>(b, a);
channelFactory.Open();
IRequestChannel channel = channelFactory.CreateChannel();
channel.Open();
Message response = channel.Request(requestMessage);

The client certificate is uploaded properly. However, after that I am not sure if I named each function correctly.

Fact: the last line of the code fragment produces MessageSecurityExceptionthe contents

The client cannot determine the name of the service participant based on the identifier in the destination address http: // myServerUrl 'for the purposes of SspiNegotiation / Kerberos, the identifier of the destination address must be UPN identifier (for example, acmedomain \ alice) or SPN identifier (for example, host / bobs-machine )

What is the cause of this problem?

+3
1

ClientCredentialType Windows , Sspi/Kerberos. "" , . "" :

http://msdn.microsoft.com/en-us/library/ms733098.aspx

0

Source: https://habr.com/ru/post/1716596/


All Articles