配置Web.config文件显示错误信息

1. 程序发布到IIS,打开页面报错很笼统,没有显示详细的错误信息

2. 配置Web.config如下,发现还是没有显示详细信息

<configuration>
  <system.web>
     <customErrors mode="Off" />
  </system.web>
  <system.webServer>
     <httpErrors errorMode="Detailed" />
  </system.webServer>
</configuration>

3. 需配置framework中的machine.config

<deployment retail="false" />

参考信息

https://stackoverflow.com/questions/101693/customerrors-mode-off

In my machine.config file I had an entry under <system.web>:

<deployment retail="true" />

This seems to override any other customError settings that you have specified in a web.config file, so setting the above entry to:

<deployment retail="false" />

now means that I can once again see the detailed error messages that I need to.

The machine.config is located at

32-bit

%windir%\Microsoft.NET\Framework\[version]\config\machine.config

64-bit

%windir%\Microsoft.NET\Framework64\[version]\config\machine.config 
    原文作者:winnerxxyy
    原文地址: https://blog.csdn.net/zengweibo123/article/details/105251258
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞