Search code examples
c#asp.netiis-7requestresponse

Server not responding for only long requests. Underlying connection was closed. ReadResponse() failed


I have tried the following solutions:

1) Increase timeout in client request.

2) Increase server ExecutionTimeout in web.config HTTPRuntime tag.

3) I have tried using both ASMX and WCF services. Even when the server page takes time (code behind), an error appears "ReadResponse() failed: The server did not return a response for this request.".

4) Change the application pool timeouts from IIS.

5) Change the IIS > My website > HTTP response header > Set common headers > Enable/Disable HTTP alive

I am using following code to test server timeout issue:

    [WebMethod]
    public string LongRequest(int delaySeconds)
    {
        Thread.Sleep(delaySeconds*1000);
        return "Delayed for " + delaySeconds + " Seconds";
    }

We have different servers but this issue is appearing only on one server.

Note! This issue only appears when a request takes more than 40 seconds. (this time is not specific as it increases decreases everytime)


Solution

  • Issue resolved. I figured out that server switches were configured to close longer requests. I have now used internal IP of the server (which is accessible from our other servers only).