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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM