Vishwamohan

Welcome to Vishwa's blog - Technology, Spirituality and More...

Error: A call to SSPI failed

If you are configuring your client application to use WCF net TCP binding, you may come across the following error.

A call to SSPI failed, see inner exception.The target principal name is incorrect

So you will find yourself stumped as what is wrong with it, how to fix it.

 

Problem:  The basic issue is the user name or principal name, as stated in the exception. You have to make sure that it should use the user to communicate under the account the service is running. So here is an example as how to fix this issue

 

First check the WSDL of the service you are using, it will look like following towards the end of WSDL file

 

<wsdl:port name="netTcpEndpoint_IMyService" binding="tns:netTcpEndpoint_IMyService">
    <soap12:address location="net.tcp://MyDomain.net/MyService.svc" />
    <wsa10:EndpointReference>
      <wsa10:Address>net.tcp://MyDomain.net/MyService.svc</wsa10:Address>
      <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
        <Upn>testUser@MyDomain.net</Upn>
      </Identity>
    </wsa10:EndpointReference>
  </wsdl:port>
 
Resolution: Ensure in your client side config file that the following information is there.

<
endpoint address="net.tcp://MyDomain.net/MyService.svc" binding="netTcpBinding" bindingConfiguration="netTcpEndpoint_IMyService" contract="MyService.IMyService" name="netTcpEndpoint_IMyService"> <identity> <dns value="MyDomain.net"/> <userPrincipalName value="testUser@MyDomain.net" /> </identity> </endpoint>
 
So Make sure both identities or user name are same.If you are using the client under same application domain, you may not need to provide user principle name or dns info, as by default it will use the same.
Loading