The server has rejected the client credentials

Our WinForm program is isomorphic to WCF and is connected to the server deployed on the server. Today, many WinForm users report that they have encountered problems when using WinForm and thrown an exception. The server has rejected the client credentials

Now let’s talk about the security authentication of WCF. Generally, our LAN applications do not have any security configuration, so what is the default security configuration of WCF?If no security configuration is made, WCF adopts windows security authentication. The default configuration is as follows:


  <binding name="netTcp">

    <security mode="Transport">

      <transport clientCredentialType="Windows" />




After checking, it is found that all computers that throw exceptions have been disabled in the ad domain. WCF in the server because it is windows authentication, so found that the user has a problem, it threw this exception. When the users in the ad domain are restored, WCF will be normal.


It should be pointed out that there are other possible reasons for this exception. For example, when the WCF server needs to impersonate the client identity, it needs the client to provide the user name and password. If it does not, it will throw this exception.


In addition, if the security requirements are not so high, we can disable all security related settings. The configuration is as follows:



    <binding name="customTcpBinding" maxReceivedMessageSize="20480000" transferMode="Streamed" >

      <security mode="None"></security>




In this way, you will no longer carry out identity authentication, and you will never throw an exception similar to identity authentication. As long as the corresponding server IP and port can be accessed, you can call it normally.

Read More: