Azure website error 502

I have an ASP.NET Webforms application on Azure, but I always get the following error on some sites: 502 - The web server received an invalid response acting as a gateway or proxy.

I have already read a lot of topics regarding the 502 error on Azure, but I still don't understand what the problem is in my specific situation.

The error occurs only on some site of the application. I can always reproduce the following pattern:

  • Open SITENAME.azurewebsites.net → An error occured
  • Open SITENAME.azurewebsites.net/Site1.aspx -> No error occurs
  • Open SITENAME.azurewebsites.net/Site2.aspx -> No error occurs
  • Refresh SITENAME.azurewebsites.net/Site2.aspx → An error occured and won't go away until I call Site1.aspx again

The only thing I found in the log is that the application is loading System.Windows.Forms.dll and an AccessViolationException exists. I don't know why this DLL is loaded at all because there is no reference in Visual Studio in any project in Visual Studio, but that's a different story :).

But I don't understand that the 502 error does not always occur on the 502 site. Maybe someone can give me a hint what the problem might be or how I can find it ...

Thank you for your help!

EDIT: What I forgot to mention: in some threads regarding this error, I read that it happens after 3 minutes or something. In my case, almost almost 25 seconds before the error appears.

+3


source to share


2 answers


This indicates a problem with the application. The reason you are wasting 502 is because the workflow crashes and the front end is left with an unanswered request and returns 502 to say exactly that. Find eventlog.xml

the LogFiles folder for your site. Alternatively, you can try .

System.Windows.Forms.dll

contains a lot of UI code that most likely won't work with Azure Sandboxes. The reason it is loaded is probably because you are using something from an assembly, or using something that uses something from that assembly. It does not need to be listed in Visual Studio for download, as it is part of the standard .NET Framework.



I would suggest looking into remote debugging and figuring out at what point this loads and why.

+8


source


In my case, I got 502 errors because the site was restarted by the azure line auto-healing system. It turns out I ran tests with this auto-healing system a few days ago, but since I eventually turned it off, I didn't think it could cause my 502 errors.

Here I found that the azure interface for changing auto-healing settings (mywebsite.scm.azurewebsites.net/Support -> mitigate) only affects the production slot. But when you swap deployment locations, the settings are swapped. Apparently there is no way to directly change the settings of the intermediate slot, you need to swap, change the settings and do the exchange again.



So, I had my studio slot with auto-healing enabled, and my production slot with auto-healing disabled (and of course, at the time, I thought it was disabled on both slots). Then I "accidentally" hit 502 errors on either staging or production depending on how many times I changed them. What's weird is that while the app seems to be reloading (or at least not responding to multiple requests), I don't get the corresponding events in my log file, for example if it didn't fire Application_Start after starting a pool reuse loop applications by an automatic healing system.

Took me all day to find out what's going on, I hope this answer can help someone in the same situation.

+1


source







All Articles