GoDaddy windows主机使用web.config显示详细错误

 

使用GoDaddy windows空间的的用户经常遇到500错误,而自己又不清楚到底哪里出错了。下面就介绍用创建web.config文件以显示详细的错误信息。

默认情况下如果你的.NET程序出现错误,客户端显示以下错误:

Server Error in ‘/mytestapp’ Application.

Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.

我们可以通过创建或修改web.config文件使之显示详细的错误:

<!– Web.Config Configuration File –>
<configuration>
  <system.web>
    <customErrors mode=”RemoteOnly”/>
  </system.web>
</configuration>

如果把上面的RemoteOnly修改为Off,则能显示详细的错误信息。

另外使用web.config文件还可以配置404错误页面,配置MIME类型等

原文地址:https://www.cnblogs.com/scgw/p/1940773.html