An error occurred while receiving the HTTP response,when returning large amount of records(about 20000 or more) RRS feed

  • Question

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

        <httpRuntime maxRequestLength="102400" />

    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!

    Wednesday, February 20, 2013 11:21 AM


  • Hi,

    Enable tracing for your service will help you to locate the actual issue and use SvcTraceViewer.exe tool to analyze the diagnostic traces.

    Suggest you check both your server side and client side configs( MaxArrayLength in readerQuotas, maxReceivedMessageSize and maxBufferSize of the binding ect.) to change to allow enough payload that http will send or receive.

    Best Regards.

    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 22, 2013 2:58 AM