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

时间:2018-07-06 13:13:47

标签: c# wcf datacontract ierrorhandler communicationexception

我遇到了以下例外情况,而没有洞悉到底出了什么问题。

  

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

我知道这是由于在有线业务方面反序列化DataContract而发生的。电线(客户和业务)的两侧都有DataContract等价物。

由于域的复杂性,在这里很难添加参考,但是到目前为止,我一直在通过从客户端的[DataMember]属性中删除[DataContract]来隔离和解决这些问题。线。我可以继续以这种方式解决问题,但这对我来说是一件繁琐的工作,而且花了很多时间,所以我很想知道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的自定义实现。

0 个答案:

没有答案