How do I get the details of an Error 500 for an Az

2020-07-09 02:56发布

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.

2条回答
干净又极端
2楼-- · 2020-07-09 03:50

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.

查看更多
狗以群分
3楼-- · 2020-07-09 03:53

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.

查看更多
登录 后发表回答