Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.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# 动态CRM导致通信异常_C#_Communication_Dynamics Crm 2011_Dynamics Crm Online_Communicationexception - Fatal编程技术网

C# 动态CRM导致通信异常

C# 动态CRM导致通信异常,c#,communication,dynamics-crm-2011,dynamics-crm-online,communicationexception,C#,Communication,Dynamics Crm 2011,Dynamics Crm Online,Communicationexception,我正在使用MS Dynamics CRM api从中获取数据(超过5000条记录) 我使用基于XML的查询来获取数据 EntityCollection resultSet = _orgServiceProxy.RetrieveMultiple(new FetchExpression(query)); 有时它工作,大多数时候它抛出异常,从日志中,我得到这个长异常 接收对的HTTP响应时出错。这可能是由于服务端点绑定未使用HTTP协议造成的。这也可能是由于服务器中止了HTTP请求上下文(可能是由于

我正在使用MS Dynamics CRM api从中获取数据(超过5000条记录)

我使用基于XML的查询来获取数据

EntityCollection resultSet = _orgServiceProxy.RetrieveMultiple(new FetchExpression(query));
有时它工作,大多数时候它抛出异常,从日志中,我得到这个长异常

接收对的HTTP响应时出错。这可能是由于服务端点绑定未使用HTTP协议造成的。这也可能是由于服务器中止了HTTP请求上下文(可能是由于服务关闭)。有关详细信息,请参阅服务器日志。-->System.ServiceModel.CommunicationException:接收对的HTTP响应时出错。这可能是由于服务端点绑定未使用HTTP协议造成的。这也可能是由于服务器中止了HTTP请求上下文(可能是由于服务关闭)。有关详细信息,请参阅服务器日志。-->System.Net.WebException:基础连接已关闭:接收时发生意外错误。-->System.IO.IOException:无法从传输连接读取数据:远程主机强制关闭了现有连接。-->System.Net.Sockets.SocketException:远程主机在System.Net.Sockets.NetworkStream.Read(Byte[]buffer,Int32 offset,Int32 size)----内部异常堆栈跟踪的结束---System.Net.Sockets.NetworkStream.Read(Byte[]buffer,Int32 offset,Int32 size)在System.Net.FixedSizeReader.ReadPacket处强制关闭了现有连接(字节[]缓冲区,Int32偏移量,Int32计数)在System.Net.Security。_sstream.StartFrameHeader(字节[]缓冲区,Int32偏移量,Int32计数,AsyncProtocolRequest asyncRequest)在System.Net.Security。_sstream.StartReading(字节[]缓冲区,Int32偏移量,Int32计数,AsyncProtocolRequest asyncRequest)在System.Net.Security。_sstream.ProcessRead(字节[])System.Net.TlsStream.Read(Byte[]buffer,Int32 offset,Int32 size)System.Net.PooledStream.Read(Byte[]buffer,Int32 offset,Int32 size)System.Net.Connection.SyncRead(HttpWebRequest请求,布尔userRetrievedStream,布尔ProberRead)System.Net.Connection---内部异常堆栈跟踪结束---位于System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超时)的System.Net.HttpWebRequest.GetResponse()处---内部异常堆栈跟踪结束


我不知道为什么会发生这种情况?

CRM服务根本不喜欢在一个请求中检索大量数据

我建议您使用分页cookie按集合检索记录。它应该可以解决您的问题并提高代码的性能

你可以找到一个很好的msdn教程

问候,

凯文