通信对象 System.ServiceModel.Channels.ServiceChannel 无法用于通信,因为其处于“出错”状态。
在 System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannelFactory.OnClose(TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannelFactory.TypedServiceChannelFactory`1.OnClose(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
在 System.ServiceModel.ChannelFactory.OnClose(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
在 System.ServiceModel.ChannelFactory.System.IDisposable.Dispose()

 

这个错误的原因,在异常信息里有部分信息:可能绑定不匹配导致的错误。

①客户端和服务器安全模式不同,例如客户端启用安全,而服务器没有启用安全;
②客户端和服务器编码模式不同,导致无法匹配错误信息。
③客户端和服务端SOAP版本不同。也可能导致问题。
④客户端和服务端事务设置不同等等。

但是都没有解决问题,后来发现我的返回类型里面有IReadOnlyList<T>,改成IList<T>或者List<T>,问题都可以解决,应该是当前的WCF版本数据契约还不支持IReadOnlyList<T>的原因吧。

相关文章:

  • 2022-12-23
  • 2021-09-14
  • 2022-01-15
  • 2022-03-02
  • 2021-08-15
  • 2022-12-23
  • 2021-06-11
  • 2022-01-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
相关资源
相似解决方案