Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the details of an Error 500 for an Azure Web App?

I have an MVC 6 site that has been deployed as an Azure Web App. I have enabled all tracing / diagnostic options in Visual Studio using Server Explorer. I am trying to do remote debugging, but I am only seeing an Error 500 on my browser, and not finding any information (or triggering an error breakpoint) on where exactly the error occurred.

I can't find any error trace on the file logs that I get from Azure.

How should I troubleshoot Error 500's in an Azure Web App?

Adding "CustomErrors": {"Mode": "Off"} to config.json didn't work.

like image 520
Jonas Arcangel Avatar asked May 24 '15 02:05

Jonas Arcangel


People also ask

How do I find 500 error details?

To view the actual error message description, in IIS Manager, expand the server node, expand Sites, select Default Web Site, and in the IIS section, double-click the Error Pages icon. The list of error codes and related IIS error pages are displayed. Right-click 500, and then click Edit Feature Settings.

Where is the Azure App Service error log?

Log detailed errors To save the error page or failed request tracing for Windows apps in the Azure portal, navigate to your app and select App Service logs. Under Detailed Error Logging or Failed Request Tracing, select On, then select Save. Both types of logs are stored in the App Service file system.


2 Answers

For MVC 6 you need to add a web.config file to the wwwroot folder with the following:

<configuration>
   <system.web>
      <customErrors mode="Off"/>
   </system.web>
</configuration>

That will add the markup to the deployed web.config file, and give you detailed errors. See http://docs.asp.net/en/latest/fundamentals/diagnostics.html#http-500-errors-on-azure for more details.

like image 70
RickAndMSFT Avatar answered Nov 08 '22 10:11

RickAndMSFT


First, you have to enable LOG files on Azure.

In MVC Core you do that by setting stdoutLogsEnabled=true in web.config -> ->

Then you go to Azure App Service console, Click on Diagnostics Logs under MONITORING Category.

There you have FTP link, where you have your LOG files stored.

Open it and you will see a detailed error. Dont forget to stop your App Service Server before you try to open LOG file, otherwise it won't be accessible.

Hope that helps you.

like image 34
Jure Avatar answered Nov 08 '22 08:11

Jure