Azure Website Error 502

前端 未结 3 1883
挽巷
挽巷 2021-02-15 15:25

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 gatew

3条回答
  •  死守一世寂寞
    2021-02-15 15:40

    In my case, I got 502 errors because the site was restarted by the azure auto-heal system. It turns out I made tests with that auto-heal system a few days ago, but since in the end I disabled it, I didn't think it could cause my 502 errors.

    This is where I discovered that the azure interface to change auto-heal settings (mywebsite.scm.azurewebsites.net/Support -> mitigate) only affects the production slot. But when you swap your deployment slots, the settings get swapped. There is apparently no way to directly change the staging slot settings, you have to swap, change settings, and swap again.

    So, I ended up having my staging slot with auto-heal enabled, and my production slot with auto-heal disabled (and of course at that time I thought it was disabled on both slots). Then I was "randomly" hitting 502 errors either on staging or production depending on how many times I swapped them. What's weird is that though the application seems to restart (or at least fails to respond to a few requests), I don't get the corresponding events in my log file, like if it wasn't running Application_Start after an app pool recycle triggered by the auto-heal system.

    Took me a whole day to find out what was happening, I hope this answer can help someone in the same situation.

提交回复
热议问题