0

I have hosted Api in azure app service.

IT was working fine but now after hitting the API it is returning status code as 502 with message

The specified CGI application encountered an error and the server terminated the process.

I have restarted the app service and it started working fine but this is happening frequently.

Is there a way to get alerts or have an automatic restart of app service if this is happening frequently or any other suggestions.

This is I found in the Azure performance

enter image description here

Any suggestion is appreciatable. Thanks for the help

Krishna089
  • 101
  • 20
  • 2
    You should add application insights to your project to get detailed logs to identify the issue in your code. – ffffff01 Jun 27 '20 at 06:17
  • 1
    Take a look here https://stackoverflow.com/questions/33645242/the-specified-cgi-application-encountered-an-error-and-the-server-terminated-the – Stelios Giakoumidis Jun 27 '20 at 11:10

1 Answers1

1

Main reasons for this type of error in app service are:

  • requests taking a long time
  • application using high memory/CPU
  • application crashing due to an exception.

For troubleshooting see: https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-http-502-http-503

For autorestarting Azure web site see: https://azure.microsoft.com/nb-no/blog/auto-healing-windows-azure-web-sites/

Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252