標籤:eth 通過 end complete contract bre .config 初始化 upper
原文地址:http://www.cnblogs.com/tianma3798/p/5470974.html
錯誤內容:
System.ServiceModel.CommunicationException: 接收對 https://xx.com/xx.svc的 HTTP 響應時發生錯誤。這可能是由於服務端點綁定未使用 HTTP 協議造成的。
這還可能是由於伺服器中止了 HTTP 要求上下文(可能由於服務關閉)所致。有關詳細資料,請參見伺服器日誌。
---> System.Net.WebException: 基礎串連已經關閉: 接收時發生錯誤。
---> System.IO.IOException: 無法從傳輸串連中讀取資料: 遠程主機強迫關閉了一個現有的串連。。
---> System.Net.Sockets.SocketException: 遠程主機強迫關閉了一個現有的串連。 在 System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) 在 System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) --- 內部異常堆疊追蹤的結尾 --- 在 System.Net.Security._SslStream.EndRead(IAsyncResult asyncResult) 在 System.Net.TlsStream.EndRead(IAsyncResult asyncResult) 在 System.Net.PooledStream.EndRead(IAsyncResult asyncResult) 在 System.Net.Connection.ReadCallback(IAsyncResult asyncResult) --- 內部異常堆疊追蹤的結尾 --- 在 System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) --- 內部異常堆疊追蹤的結尾 ---Server stack trace: 在 System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) 在 System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) 在 System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) 在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 在 Sinopec.UC.Client.Groups.ChatGroupSev.IChatGroupPersistence.EndGetGroupListByMember(IAsyncResult result) 在 Sinopec.UC.Client.Groups.ChatGroupSev.ChatGroupPersistenceClient.OnEndGetGroupListByMember(IAsyncResult result) 在 System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
解決方案1:
此類型錯誤發生時,有許多方案。
首先檢查您提供適當的 [DataContract] 和 [DataMember] 是否這不提供然後這種類型的錯誤發生。您必須編寫 [DataContract] 以上類,您傳遞的響應,並寫入 [DataMember] 以上類成員,是去用戶端響應。
[DataContract]class Program{ [DataMember] public string Exampl{get;set}}
解決方案2:
詳細監聽用戶端請求過程
如果一些 minvalue 的資料類型是通過,檢查響應中。這意味著一些時間資料成員不是初始化,時間它採取它 Minvalue。eg MinValue int 的是 ‘-2147483648‘,所以一段時間不能序列化並引發錯誤。
如果您有跟蹤這種類型的錯誤,然後寫下你的伺服器端 web.config 中的代碼下面的
<system.diagnostics><sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"> <listeners> <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "D:\Traces.svclog"/> </listeners> </source></sources>
顯示結果:
服務端異常,詳細訊息:
問題解決_WCF_WCF 接收我服務的 HTTP 響應時發生錯誤