问题描述
我有一个已部署为 Azure Web 应用程序的 MVC 6 站点.我已经使用服务器资源管理器在 Visual Studio 中启用了所有跟踪/诊断选项.我正在尝试进行远程调试,但我只在浏览器上看到错误 500,并没有找到任何关于错误发生位置的信息(或触发错误断点).
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.
我在从 Azure 获得的文件日志中找不到任何错误跟踪.
I can't find any error trace on the file logs that I get from Azure.
我应该如何解决 Azure Web 应用程序中的错误 500?
How should I troubleshoot Error 500's in an Azure Web App?
向 config.json 添加 "CustomErrors": {"Mode": "Off"} 无效.
Adding "CustomErrors": {"Mode": "Off"} to config.json didn't work.
推荐答案
对于 MVC 6,您需要将 web.config 文件添加到 wwwroot 文件夹,内容如下:
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>
这会将标记添加到已部署的 web.config 文件中,并为您提供详细的错误信息.请参阅 http://docs.asp.net/en/latest/fundamentals/diagnostics.html#http-500-errors-on-azure 了解更多详情.
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.
这篇关于如何获取 Azure Web 应用程序的错误 500 的详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!