WCF 服务在同一网络中的其他计算机上出错
本文关键字:其他 计算机 出错 网络 服务 WCF | 更新日期: 2023-09-27 18:32:31
我开发了一个使用 WCF 服务的 C# 控制台应用程序。在本地计算机上一切正常。当我创建设置文件并分发 exe 和 exe.config 文件时,应用程序在同一网络上的其他计算机上出错,并出现以下错误:
通信对象 System.ServiceModel.Channels.ServiceChannel 不能用于通信,因为它处于故障状态。
WCF 服务终结点 URL - http://inblrlwssc251.wdf.corp:7980/AfariaService/Server 也可以从其他计算机访问。不确定可能出现什么问题。
该服务的配置如下所示,我使用 WSHTTP 绑定:
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IServerService" />
</netNamedPipeBinding>
<netTcpBinding>
<binding name="NetTcpBinding_IServerService">
<security mode="Message" />
</binding>
</netTcpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IServerService" />
</wsHttpBinding>
</bindings>
<!--
Modify the "adress" in each of the endpoint tags based on where the Afaria API service is hosted
-->
<client>
<endpoint address="http://inblrlwssc251:7980/AfariaService/Server"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IServerService"
contract="AfariaServerService.IServerService" name="WSHttpBinding_IServerService">
</endpoint>
<endpoint address="net.tcp://inblrlwssc251:7982/AfariaService/Server"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IServerService"
contract="AfariaServerService.IServerService" name="NetTcpBinding_IServerService">
</endpoint>
<endpoint address="net.pipe://localhost/AfariaService/Server"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IServerService"
contract="AfariaServerService.IServerService" name="NetNamedPipeBinding_IServerService">
</endpoint>
</client>
</system.serviceModel>
任何帮助或正确方向的指针将不胜感激。
我知道
这很旧,你说它已经解决了,但为了后代的缘故,这通常不是传递错误凭据的结果。通常,这是由于服务器的响应响应使用了您配置为在缓冲区中接受的更多数据,超过了maxitemsinobject图,或者来自服务器的响应时间过长,这会导致异常,该异常已处理...这个异常是下一次调用的结果(正如 fejesjoco 和 Tim 指出的那样)。
发生这种情况时,最好重新初始化客户端/服务客户端对象(对于此 api,也调用 initContext),然后再次尝试调用。