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

感情迁移 提交于 2019-12-09 16:12:20

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/30419618/how-do-i-get-the-details-of-an-error-500-for-an-azure-web-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!