I have an ASP.NET Webforms Application on Azure but i always get the following Error on some sites: 502 - Web server received an invalid response while acting as a gateway or proxy server.
I already read a lot of topics regarding the 502 error on Azure but i still don't understand what the problem in my particular situation is.
The error occurs just on some site of the application. I can always reproduce the following pattern:
The only thing i found in the log is, that the application loads System.Windows.Forms.dll and there is an AccessViolationException. I have no idea why this dll is loaded at all because there is no Reference in any Project in Visual Studio to it but thats another story :).
But what i don't understand is that the error 502 does not always occur on Site 502. Maybe someone can give me a hint what might be the problem or how i could find it...
Thanks for your help!
EDIT: What i forgot to mention: In some threads regarding this error i read, that it occurs after 3 minutes or something like that. In my case it is nearly alway about 25 seconds until the errormessage shows up.
The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
The HTTP 502 - bad gateway error occurs when either: The timeout of the proxy was reached prior to the request completion. If the connection proxy > server drops. When the response from the server is invalid.
There is a good chance that if you have run into this error message while browsing, you're not at fault. Typically, an Error 502 bad gateway indicates that there is an issue with the website's server, rather than anything on your end.
That points to an application issue. The reason you are etting 502 is because the worker process is crashing and the front end is left with a request with no response and returning a 502 to say exactly that. Look for eventlog.xml
under the LogFiles folder for your website. Alternatively you can try remote debugging from VS to your website.
System.Windows.Forms.dll
contains a lot of UI code that will most probably not work Azure websites sandbox. The reason it's loaded is probably because you are using something from the assembly or using something that uses something from that assembly. It doesn't have to be listed in Visual Studio to be loaded since it's a part of the standard .NET Framework.
I would suggest looking into remote debugging and figuring out at what point this is getting loaded and why.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With