Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 由于WCF中的DataContract等价性,导致CommunicationObjectFaultedException_C#_Wcf_Datacontract_Ierrorhandler_Communicationexception - Fatal编程技术网

C# 由于WCF中的DataContract等价性,导致CommunicationObjectFaultedException

C# 由于WCF中的DataContract等价性,导致CommunicationObjectFaultedException,c#,wcf,datacontract,ierrorhandler,communicationexception,C#,Wcf,Datacontract,Ierrorhandler,Communicationexception,我得到了以下异常,但我不知道到底是什么地方出了问题 System.ServiceModel.CommunicationObjectFaultedException:' 通信对象,System.ServiceModel.Channels.ServiceChannel, 无法用于通信,因为它处于故障状态。' 我知道这是由于在线路的业务端反序列化DataContract造成的。在连接的双方(客户和业务)都有DataContract等价性 由于域的复杂性,很难在此处添加引用,但到目前为止,我一直通过从连

我得到了以下异常,但我不知道到底是什么地方出了问题

System.ServiceModel.CommunicationObjectFaultedException:' 通信对象,System.ServiceModel.Channels.ServiceChannel, 无法用于通信,因为它处于故障状态。'

我知道这是由于在线路的业务端反序列化DataContract造成的。在连接的双方(客户和业务)都有DataContract等价性

由于域的复杂性,很难在此处添加引用,但到目前为止,我一直通过从连线客户端的
[DataContract]
属性中删除
[DataMember]
来隔离和解决这些问题。我可以继续以这种方式解决问题,但这对我来说是一项乏味的工作,而且需要相当长的时间,因此我很想知道WCF是否能够通过在客户端返回的异常中提供详细信息来确定问题

我的服务app.config

<system.serviceModel>
    <services>
      <service name="FSX.Business.Managers.ExecutionManager" 
               behaviorConfiguration="Debugging">
        <endpoint address="net.tcp://localhost:8009/ExecutionService"
                  binding="netTcpBinding"
                  contract="FSX.Business.Contracts.IExecutionService" />
      </service>          
    </services>
    <bindings>
      <netTcpBinding>
        <binding maxReceivedMessageSize="2000000" transactionFlow="true">
          <reliableSession enabled="true"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Debugging">
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
</system.serviceModel>

我读过很多帖子,包括下面提到的几篇,但仍然无法解决这个问题。尽管我已经添加了
IErrorHandler
的自定义实现


WCF发送服务器故障原因信息的能力取决于服务器配置。如果未设置
includeExceptionDetailsInFaults
,则客户端将无法获得足够的信息。如果您看到上面的app.config,includeExceptionDetailInFaults已设置为true,但未收到失败的任何详细原因。啊,抱歉。实际上,当WCF无法反序列化“输入”对象时,此选项就不起作用。它只适用于由服务代码产生的异常,而不是由WCF基础结构产生的异常。