WCF Service throw : An error occurred while receiving the HTTP response

1.1k views Asked by At

I have WCF service and I host it in my local Server (local machine) it work's fine but when I host it in server (internet) at that time it throws below error

An error occurred while receiving the HTTP response to http://www.xxxxxxxx.com/Services/WCFService.svc. 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.

This WCF service is for upload pdf files and also do operation as per uploaded pdf file.

problem is occurred when I uploaded pdf file and that file has more pages (approx above 500) at that time it take more execution time (approx 6 to 8 minutes).

if I upload pdf file that has 100 pages, 200 pages, 300 pages, at that time it works well.

NOTE : all the pdf file has below 5 MB size.

2

There are 2 answers

0
isxaker On

Yoy need to set Max Message Size and buffer size for WCF webhttp

<bindings>
  <webHttpBinding>
    <binding name="LargeWebBinding"
             maxBufferPoolSize="2147483647"
             maxReceivedMessageSize="2147483647"
             maxBufferSize="2147483647">
      <readerQuotas 
             maxArrayLength="2147483647" 
             maxNameTableCharCount="2147483647"
             maxStringContentLength="2147483647"
             maxDepth="2147483647"
             maxBytesPerRead="2147483647" />
    </binding>

You can try to use this:

<behaviors>
  <serviceBehaviors>
    <behavior name="LargeWebBehavior">
      <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceTimeouts transactionTimeout="00:10:00" />
      <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="100"
        maxConcurrentInstances="100" />
    </behavior>
  </serviceBehaviors>
</behaviors>
0
Vojtech B On

It is possible that the processing takes too much time and the client time-outs before it is proceeded

<bindings>
  <basicHttpBinding>
    <binding name="IncreasedTimeout"
             sendTimeout="24:00:00">
    </binding>
  </basicHttpBinding>
</bindings>

Since uploading files to your localhost is instant - this timeout takes into account both server-processing and upload to your server.