Troubleshooting: the caller is not authenticated by the Service.
I have been working on both the WCF Service and client on one computer. I called it on another computer today and found a new problem: "The caller is not authenticated by the Service ",
I checked a lot of information on the Internet, and did not find anyone explaining the reasons. I just found a solution, but I personally feel that it is not the best solution, so we are still exploring.
As mentioned in the solution, you can set the security authentication to "none" on the server and the client respectively. You have tried it several times and it has not been successful. but theoretically it is okay.
In addition, I found such a solution. I don't know if I have any other opinions.
Deploying the WCF server and client on different machines separately may trigger the following exceptions.
System. ServiceModel. Security. SecurityNegotiationException not handled
Message = "the server has rejected client creden. "
Source = "mscorlib"
The solution is to adjust the server Binding security mode, for example, set it to "None ".
NetTcpBinding binding = new NetTcpBinding ();
Binding. Security. Mode = SecurityMode. None;
ServiceHost host = new ServiceHost (typeof (MyService ));
Host. AddServiceEndpoint (typeof (IService), binding, "net. tcp: // 192.168.0.112: 8081 ");
ServiceMetadataBehavior metadata = new ServiceMetadataBehavior ();
Metadata. HttpGetUrl = new Uri ("http: // 192.168.0.112: 8080 ");
Metadata. HttpGetEnabled = true;
Host. Description. Behaviors. Add (metadata );
Host. Open ();
Or set it in the configuration file.