WCF,The caller was not authenticated by the service

 

调用WCF时,出现下面的错误:

System.ServiceModel.Security.SecurityNegotiationException : The caller was not authenticated by the service.
System.ServiceModel.FaultException : The request for security token could not be satisfied because authentication failed.

解决方法:

将 binding="wsHttpBinding" 改为:binding="basicHttpBinding"    (注意:basicHttpBinding 安全性差)

Could not connect to net.tcp://222.138.109.145:8020/WCFRun. The connection attempt lasted for a time span of 00:00:01.1562500. TCP error code 10061: 由于目标机器积极拒绝,无法连接。 222.138.109.145:8020.

解决方法:

"由于目标机器积极拒绝,无法连接。"这个错误通常是由于你的Service没有启动而造成的。
如果确定Service已经启动,你可以先用Http连接试试。

原文地址:https://www.cnblogs.com/emanlee/p/2709558.html