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 the Web server (while acting as a gateway or proxy) contacted the upstream cont

BarryM 16 Reputation points
2023-01-11T19:14:49.9466667+00:00

Hi Everyone,

I need your help for my Azure deployment. Previously i cant publish my asp.net core app to my app service with no problem. but now i encounter this error "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 the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server."

In my visual studio and testing my app locally it is working, just this happens after i deploy it.

Please help me on this issue as i am a beginner in using this azure.

Thank You in Advance.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,201 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 23,691 Reputation points Microsoft Employee
    2023-01-17T05:14:07.5433333+00:00

    @BarryM Thank you for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    The status code 502 is a generic and it might be occurred due to multiple reasons like

    • If the request is taking longer than expected or longer time to execute
    • your application is running with high cpu/memory usage.
    • Application might crash due to multiple exceptions.

    You can leverage this troubleshooting guide to troubleshoot and fix 502 or 503 errors on app service.
    Alternatively, you can use Diagnostic and solve problems under your webapp or you can enable the diagnostic logs in azure app service to identify the cause

    Feel free to reach back to me if you have any further questions on this.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.