Asp.net 接收HTTP响应时,返回大量记录(约20000条或更多)时出错
问题: 我有一个函数,它返回列表中的大量记录,所以在获取此记录时,会抛出以下异常。异常和堆栈跟踪的详细信息如下所述: 异常:接收对此的HTTP响应时发生错误,可能是由于服务端点绑定未使用HTTP协议。这也可能是由于服务器中止了HTTP请求上下文(可能是由于服务关闭)。有关详细信息,请参阅服务器日志 堆栈跟踪: 服务器堆栈跟踪: 位于System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException WebException、HttpWebRequest请求、HttpBortreason abortReason) 位于System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超时) 位于System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时) 位于System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时) 在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类型) 据我所知,这是一种请求超时问题。 我已尝试在web.config中设置以下内容,但没有帮助Asp.net 接收HTTP响应时,返回大量记录(约20000条或更多)时出错,asp.net,wcf,http-request,Asp.net,Wcf,Http Request,问题: 我有一个函数,它返回列表中的大量记录,所以在获取此记录时,会抛出以下异常。异常和堆栈跟踪的详细信息如下所述: 异常:接收对此的HTTP响应时发生错误,可能是由于服务端点绑定未使用HTTP协议。这也可能是由于服务器中止了HTTP请求上下文(可能是由于服务关闭)。有关详细信息,请参阅服务器日志 堆栈跟踪: 服务器堆栈跟踪: 位于System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(We
<system.web>
<httpRuntime maxRequestLength="102400" />
</system.web>
如何解决这个问题,有什么解决办法吗?或者有什么办法可以解决?可以避免任何可以处理大量数据或此异常的方法/技术
提前谢谢 您可以在web.config中设置此值。例如,要更改一个特定页面的超时,请执行以下操作:
<location path="somefile.aspx">
<system.web>
<httpRuntime executionTimeout="180"/>
</system.web>
</location>
有关更多详细信息,请参阅
希望这会有所帮助。您需要在配置中设置大数据绑定值。在服务配置中添加以下服务行为
<behaviors>
<serviceBehaviors>
<behavior name="SilverlightWCFLargeDataApplication">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="SilverlightWCFLargeDataApplication">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
此链接不再可用:(将版本更改为4.0并查看MSDN