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

标签 asp-classic web-config iis-7.5

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

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

当我预览页面时,出现此错误。

处理URL时服务器上发生错误。请联系
系统管理员。

如果您是系统管理员,请单击此处以了解更多信息。
这个错误。

最佳答案

您所拥有的是正确的,但是您还需要告诉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.

will be sent.

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配置继承的工作方式很酷,因此应使用特定于站点的False文件中定义的值覆盖applicationHosts.configweb.config的默认值。

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

有用链接
  • Configuration Reference - system.webServer - ASP(可以在web.config文件中配置的详细信息属性和childNodes)
  • How to Use Locking in IIS 7.0 Configuration(深入了解如何通过锁定更高级别来影响配置)
  • Delegating Configuration in IIS 7.0(显示如何将配置委派给网站所有者)
  • Delegating errorMode in httpErrors(本文特定于您的特定问题,但可能有助于阐明该问题)
  • 关于asp-classic - 在IIS 7.5上显示详细的错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42965900/

    相关文章:

    asp-classic - 经典asp——如何自动化部署——在持续集成环境中

    asp-classic - ASP经典下载文件脚本

    grails - 为Grails中的域类生成XML模式

    asp.net - 在 ASP.NET web.config 文件中设置备份数据库服务器

    iis-7.5 - 托管在 IIS 7.5 和 Windows Server 2008 R2 中的 Web API 2 提供 403.14

    javascript - 经典 ASP 在页面之间传递值

    azure - 无需 Web.Config 即可更改 Azure 上接受的 MIME 类型

    .net - 无法检索日志记录设置 - IIS web.config .Net Core 1.1

    asp.net - 作为现有 asp.net 站点的应用程序运行时,iisnode 错误 500

    .net - 在ASP.net MVC2中解析 “this operation requires IIS integration pipeline mode”