具體錯誤信息例如以下:
System.ServiceModel.CommunicationException: 接收對 http://110.110.110.110/TestService/TestService.svc 的 HTTP 響應時錯誤發生。這可能是因為服務終結點綁定未使用 HTTP 協議造成的。
這還可能是因為server中止了 HTTP 請求上下文(可能因為服務關閉)所致。有關具體信息,請參見server日志。
---> System.Net.WebException: 基礎連接已經關閉: 接收時錯誤發生。
---> System.IO.IOException: 無法從傳輸連接中讀取數據: 遠程主機強迫關閉了一個現有的連接。。 ---> System.Net.Sockets.SocketException: 遠程主機強迫關閉了一個現有的連接。
在 System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) 在 System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- 內部異常堆棧跟蹤的結尾 --- 在 System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) 在 System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) 在 System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- 內部異常堆棧跟蹤的結尾 --- 在 System.Net.HttpWebRequest.GetResponse() 在 System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- 內部異常堆棧跟蹤的結尾 --- Server stack trace: 在 System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) 在 System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 在 System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) 在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(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) //部分出錯函數信息提示
錯誤原因:
通過WCF來傳遞DataTable
解決:
WCF中傳遞的DataTable替換成Dataset(已驗證)
或者(未驗證)
圖片資料來源:點擊打開鏈接