简体   繁体   English

WCF服务错误出在同一网络中的其他计算机上

[英]WCF service errors out on other machines in the same network

I developed a C# console application that consumes a WCF service. 我开发了使用WCF服务的C#控制台应用程序。 All works fine on the local machine. 在本地计算机上一切正常。 When I created the set up files and distributed the exe and exe.config files, the application errors out on other machines on the same network with the below error: 当我创建设置文件并分发exe和exe.config文件时,应用程序会在同一网络上的其他计算机上出错,并显示以下错误:

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.. 通信对象System.ServiceModel.Channels.ServiceChannel不能用于通信,因为它处于故障状态。

The WCF service endpoint URL - http://inblrlwssc251.wdf.corp:7980/AfariaService/Server is accessible form other machines as well. WCF服务终结点URL- http://inblrlwssc251.wdf.corp:7980 / AfariaService / Server也可以从其他计算机访问。 Unsure what can be going wrong. 不确定会出什么问题。

The configuration for the service looks as below, I use the WSHTTP binding: 该服务的配置如下所示,我使用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>

Any help or a pointer in the right direction will be very much appreciated. 任何帮助或在正确方向上的指点将不胜感激。

I know that this is old and you said it is resolved, but for posterity's sake this is not typically the result of passing incorrect credentials. 我知道这很旧,您说它已解决,但是为了后代,这通常不是传递不正确凭据的结果。 Normally this is a result of the response from the server responding with more data that you've configured to accept in your buffers, exceeding the maxitemsinobject graph, or the response from the server taking too long, which causes an exception, which is handled... and this exception is the result of the next call (as fejesjoco and Tim pointed out). 通常,这是服务器响应的结果,其中服务器响应您配置为在缓冲区中接受的更多数据,超过了maxitemsinobject图,或者服务器响应时间过长(导致异常),该异常会得到处理。 ..并且此异常是下一次调用的结果(如fejesjoco和Tim所指出的)。

When this occurs, it is best to reinitialize the client/serviceclient object (for this api, also call initContext) and then try the call again. 发生这种情况时,最好重新初始化client / serviceclient对象(对于此api,也请调用initContext),然后重试该调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM