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

在将程序发布到IIS后,遇到错误提示信息不具体的问题。尝试通过修改Web.config文件来显示详细错误,但未能成功。进一步了解到,需要在framework的machine.config文件中进行设置,关闭customErrors模式,以便查看所需的详细错误信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值