本文介绍了在IIS 7.5上显示详细的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to display detailed error message on a page using web.config on my remote server on hostgator running IIS 7.5. I've tried almost everything but can't get it to work.

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

预览页面时出现此错误.

When i preview the page i get this error.


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.

推荐答案

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

What you have is correct but you also need to tell the Classic ASP handler to send errors to the browser or the default


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配置,例如;

To do this you just need to override the current ASP configuration by updating the web.config file, something like;

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

由于IIS配置继承的工作方式很酷,因此应使用特定于站点的web.config文件中定义的值覆盖applicationHosts.config中的False默认值.

Because of the cool way IIS Configuration inheritance works this should override the default value of False in applicationHosts.config with the value defined in the site specific web.config file.

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

It's worth noting that in some budget / shared hosting environments where you have no access to server configuration you may have problems setting certain configuration values, because the owner (Hosting Company etc) has configured the applicationHosts.config section with a value of overrideModeDefault="Deny" locking a section from having configuration values overridden at the web application level.

有用链接

  • Configuration Reference - system.webServer - ASP (Details attributes and childNodes that can be configured in the web.config file)
  • How to Use Locking in IIS 7.0 Configuration (An insight into how configuration is affected by locking at higher levels)
  • Delegating Configuration in IIS 7.0 (Shows how configuration can be delegated to site owners)
  • Delegating errorMode in httpErrors (This article is specific to your particular problem but might help shine some light on the problem)

这篇关于在IIS 7.5上显示详细的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 12:53