wcf错误

wcf在本地调试没问题,但是发布到远程服务器后就报错了,在添加此节点条件下

<binding name="NoneSecurity"
          maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000" useDefaultWebProxy="false">
          <readerQuotas maxStringContentLength="12000000" maxArrayLength="12000000"/>
          <security mode="None"/>
        </binding>出现的以下三种错误

1.无法打开安全通道,因为与远程终结点的安全协商已失败。这可能是由于用于创建通道的 EndpointAddress 中不存在 EndpointIdentity 或错误指定了 EndpointIdentity。请确认由 EndpointAddress 指定或暗示的 EndpointIdentity 正确标识了远程终结点

由于客户端<endpoint name="aaa" address="http://地址/wcf/Service1.svc" bindingConfiguration="NoneSecurity"  contract="WcfService1.IService1" binding="wsHttpBinding"></endpoint>没有添加bindingConfiguration="NoneSecurity"但是服务器端添加着,所导致的错误;将客户端添加上就可以了.

2.action 'http://tempuri.org/IService1/Add' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

这是由于服务器端没有添加bindingConfiguration="NoneSecurity"但是客户端添加着,所导致的错误;将服务器端添加上就可以了.

3.调用方未由服务进行身份验证。

这是由于服务器端和客户端都没有添加造成的错误

原文地址:https://www.cnblogs.com/songling/p/2721667.html