在IIS 7.5上显示详细的错误消息

时间:2015-04-11 22:28:00

标签: asp-classic web-config iis-7.5

我正在尝试在运行IIS 7.5的hostgator上的远程服务器上使用web.config在页面上显示详细的错误消息。我已经尝试了几乎所有东西,但无法让它发挥作用。

<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" existingResponse="PassThrough" />
  </system.webServer>
</configuration>

当我预览页面时,我收到此错误。

An error occurred on the server when processing the URL. Please contact the 
system administrator.

If you are the system administrator please click here to find out more about 
this error.

2 个答案:

答案 0 :(得分:1)

也许获取详细信息的其他方式(对不起,这是针对IIS 8.5)

Step1

Step2

在上面的评论中查看500.asp页面的样本

答案 1 :(得分:0)

您所拥有的是正确的,但您还需要告诉Classic ASP处理程序将错误发送到浏览器或默认

An error occurred on the server when processing the URL. Please contact the 
system administrator.

If you are the system administrator please click here to find out more about 
this error.

将被发送。

要执行此操作,您只需要通过更新web.config文件来覆盖当前的ASP配置,例如;

<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" existingResponse="PassThrough" />
    <asp scriptErrorSentToBrowser="True" />
  </system.webServer>
</configuration>

由于IIS配置继承的酷炫方式,这应该覆盖FalseapplicationHosts.config的默认值,并使用特定于站点的web.config文件中定义的值。

值得注意的是,在某些您无法访问服务器配置的预算/共享托管环境中,您可能无法设置某些配置值,因为所有者(托管公司等)已将applicationHosts.config部分的值overrideModeDefault="Deny"配置为锁定某个部分,使其在Web应用程序级别覆盖配置值。


有用的链接