Tuesday, 15 November 2016

502 - Web server received an invalid response while acting as a gateway or proxy server.

I had a problem in an ASP.Net web application hosted on IIS 8.0 and there was ARR server to load balance requests.

The error was as follows, sometimes when I hit the URL the below error appears and when I refresh the page the error disappears.

502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed.

When investigating the issue I found that it was happening randomly and happened always for long requests (when I upload a file or requesting heavy pages).
After lots of searching I found that the error code is 502.2 which related to 
  • 502.2 - Bad gateway: Premature Exit.
as per Microsoft error codes for IIS in the below link 

And the solution was very simple, Just increase the ARR request timeout as the below screenshots




Important Note: If you are using IIS 7.0 or 7.5 you can take a loot at the below hotfixes from Microsoft, would be helpful

No comments:

Post a Comment