0
votes

Problem: I have one function which return large amount of record in terms of list, so while getting this record,following exception is thrown. The details of exception & stack trace are mentioned bellow:

Exception: An error occurred while receiving the HTTP response to This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Stack Trace: Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)

at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

As per my understanding is sort of request timeout issue. I have tried to set following in web.config, but didn't help.

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

How to solve this issue, any work around? or any alternative to sort out? Any method/ technique that can handle large amount of data or this exception can be avoided.

Thanks in advance!

2

2 Answers

0
votes

You can set this value in web.config. For example, to change the timeout for one specific page:

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

See http://msdn2.microsoft.com/en-us/library/e1f13641.aspx for more details.

Hope that helps.

0
votes

You need to put large data binding values in the configuration. Add the following service behaviors in your configuration of the service.

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