通信对象 System.ServiceModel.Channels.ServiceChannel 无法用于通信,因为其处于“出错”状态。...

通信对象 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>的原因吧。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值