Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASPX.NET Core - random 502 error on IIS server

We just launched a site that runs on ASP.NET Core 1.1, Windows 2008R2, IIS 7.5 with all the latest patches to 2008 and asp.net. The site runs fine, but goes down with no apparent pattern. All of a sudden it would start returning 502 response:

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

Restarting the site in IIS, or recycling site’s application pool brings the site up, but the problem reoccurs within a few hours. As workaround, we configured IIS to recycle app pool every 90 minutes, and that seemed to keep the site up all of the time. Any recommendations on how to troubleshoot this problem?

Thank you!

like image 320
Ross Avatar asked Nov 24 '16 16:11

Ross


People also ask

How do I fix 502 bad gateway in IIS?

Resolving The ProblemSet the IIS Application Request Routing (ARR) timeout to a higher setting. The default is 120 seconds, at which point ARR times out the request. Test setting the timeout to 160 and restarting the IIS server.

What is IIS 502 error?

HTTP 502 - Overview. When working with IIS Application Request Routing (ARR) deployments, one of the errors that you may see is "HTTP 502 - Bad Gateway". The 502.3 error means that - while acting as a proxy - ARR was unable to complete the request to the upstream server and send a response back to the client.


1 Answers

IIS says with this 502 error that Kestrel (behind it) returned something "wrong". Enable (more) logging, and inspect logs before first 502 response. Some previous request "breaks" your app.

like image 79
Dmitry Avatar answered Oct 11 '22 12:10

Dmitry