Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCF错误“;插座连接已被处理;_C#_.net_Wcf_.net 4.0 - Fatal编程技术网

C# WCF错误“;插座连接已被处理;

C# WCF错误“;插座连接已被处理;,c#,.net,wcf,.net-4.0,C#,.net,Wcf,.net 4.0,我有一个WCF服务,它可以根据输入参数返回大量数据 该服务作为ServiceHost可执行文件在我的计算机上运行,我现在正在使用WCF测试客户端进行测试 这是我的主机配置: 这是我的客户端配置: 下面是我得到的错误: 套接字连接已被释放。 服务器堆栈跟踪: 位于System.ServiceModel.Channels.SocketConnection.ThrowIfNotOpen()处 位于System.ServiceModel.Channels.SocketConnection.Rea

我有一个WCF服务,它可以根据输入参数返回大量数据

该服务作为ServiceHost可执行文件在我的计算机上运行,我现在正在使用WCF测试客户端进行测试

这是我的主机配置:


这是我的客户端配置:


下面是我得到的错误:

套接字连接已被释放。
服务器堆栈跟踪:
位于System.ServiceModel.Channels.SocketConnection.ThrowIfNotOpen()处
位于System.ServiceModel.Channels.SocketConnection.Read(字节[]缓冲区,Int32偏移量,Int32大小,TimeSpan超时)
位于System.ServiceModel.Channels.DelegatingConnection.Read(字节[]缓冲区,Int32偏移量,Int32大小,TimeSpan超时)
在System.ServiceModel.Channels.PreReadConnection.Read(字节[]缓冲区,Int32偏移量,Int32大小,TimeSpan超时)
位于System.ServiceModel.Channel.SingletonConnectionReader.SingletonInputConnectionStream.ReadCore(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.ServiceModel.Channel.SingletonConnectionReader.SingletonInputConnectionStream.Read(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.ServiceModel.Channels.MaxMessageSizeStream.Read(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.ServiceModel.Channels.SingletonConnectionReader.Close(TimeSpan超时)
在System.ServiceModel.Channels.SingletonConnectionReader.SingletonInputConnectionStream.Close()中
在System.ServiceModel.Channels.DelegatingStream.Close()中
在System.Xml.XmlBufferReader.Close()处
在System.Xml.xmlbasereder.Close()处
在System.Xml.xmlbaryreader.Close()处
在System.Xml.XmlReader.Dispose(布尔值disposing)处
在System.Xml.XmlReader.Dispose()处
位于System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContent(消息消息,对象[]参数,布尔值isRequest)
位于System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(消息消息,对象[]参数)
位于System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc&rpc)
位于System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc&rpc)
在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime操作、对象[]输入、对象[]输出、时间跨度超时)
位于System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage方法调用,ProxyOperationRuntime操作)
位于System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)
在[0]处重试异常:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
at System.Runtime.Remoting.proxy.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)
在IExchangeRepository.SearchExchangeRequest(字符串AccountNumber、Int32 StatusCode、Int32 StartDate、Int32 EndDate)
在ExchangePositoryClient.SearchExchangeRequest(字符串AccountNumber、Int32 StatusCode、Int32 StartDate、Int32 EndDate)
内部异常:
套接字连接已被释放。
对象名称:“System.ServiceModel.Channel.SocketConnection”。
当返回的数据包含的记录数超过一定数量时,会发生此错误。数据越少,一切正常


对如何解决这个问题有什么建议吗

这一切都是由愚蠢的数据问题造成的。 错误消息是完全无用的。启用跟踪允许查看实际异常。
谢谢你,EkoostikMartin

第一步是启用跟踪-这很难说,但我猜您在某个地方有一个
using(){}
块,它在堆栈仍在传输数据的过程中完成并处理某些内容。虽然很难提供帮助,但却看不到更多(可能还有很多)代码。这一切都是由愚蠢的数据问题造成的。错误消息是完全无用的。启用跟踪允许查看实际异常。谢谢你,EkoostikMartin!我有一个相同的异常发生,在我的例子中,它是由超时引起的。我通过启用跟踪发现了问题。