Saturday, December 22, 2018

WCF Client - Not Working for ws.* and net-tcp protocols

When we configure a code with basic http binding, it works fine.

However, when we switch the same with some secure bindings like wshttpBinding or net-tcp bindings. System throws the following error, 

Win32Exception: The Security Support Provider Interface (SSPI) negotiation failed.

This error is because, for the secure bindings, system automatically adds the identity for the channel, as below, Hear, the userPrincipalName provided is not valid.

We can now make the bindings work in either of the below gives two ways,

Method 1: By disabling the identity option We can simply comment out the section inside the wsHttpBinding and it will work. 

Method 2: Other the other hand by providing the proper userPrincipleName. How to check the proper userPrincipleName for any machine or server. 

Go to RUN > CMD (open your command prompt) and check with this command. whoami /upn In my machine, I got the ID as gopvasan@publicisgroupe.net. 

 So by replacing the tag with the below, fixed this issue.