2013-02-20 53 views
0

問題時: 我有一個函數,返回列表而言大量記錄,因此而得到這個紀錄,以下情況除外被拋出。例外&堆棧跟蹤的細節波紋管提及:錯誤,返回大量的記錄(約20000或更多)

異常:在接收到該HTTP響應可能是由於服務端點不使用HTTP協議結合時發生錯誤。這也可能是由於一個HTTP請求上下文服務器(可能是由於服務關停)被中止。查看服務器日誌獲取更多詳細信

堆棧跟蹤: 服務器堆棧跟蹤: 在System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(引發WebException引發WebException,HttpWebRequest的請求,HttpAbortReason abortReason)

在System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel。 HttpChannelRequest.WaitForReply(時間跨度超時)

在System.ServiceModel.Channels.RequestChannel.Request(消息消息,時間跨度超時)

在System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,時間跨度超時)

在System.ServiceModel.Channels.ServiceChannel.Call(字符串動作,布爾單向,ProxyOperationRuntime操作,對象[]項,對象[]奏,時間跨度超時)

在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage包括methodCall,ProxyOperationRuntime操作)

在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即時聊天消息)

異常重新拋出在 [ 0]: 在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即時聊天reqMsg,即時聊天retMsg)

在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData & MSGDATA,的Int32類型)

根據我的理解,有些請求超時問題。 我試圖設置以下在web.config中,但並沒有幫助。

<system.web> 
    <httpRuntime maxRequestLength="102400" /> 
    </system.web> 

如何解決這個問題,任何解決方法?或任何其他的選擇?可以避免任何可以處理大量數據或此異常的方法/技術。

在此先感謝!

回答

0

您可以在web.config中設置此值。例如,要更改超時一個特定頁面:

<location path="somefile.aspx"> 
    <system.web> 
      <httpRuntime executionTimeout="180"/> 
    </system.web> 
</location> 

詳情請參閱http://msdn2.microsoft.com/en-us/library/e1f13641.aspx

希望有所幫助。

+0

此鏈接不再可用:( – user1746468 2013-02-21 12:25:13

+0

更改版本4.0和檢查MSDN – Sakthivel 2013-02-21 12:56:27

+0

@ codebrain:感謝 – user1746468 2013-02-21 13:03:00

0

您需要將大數據綁定值放在配置中。在您的服務配置中添加以下服務行爲。

<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>