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 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.