关闭IIS7 HTTP错误处理? [英] Turn IIS7 HTTP Error Handling Off?

查看:194
本文介绍了关闭IIS7 HTTP错误处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在参加比赛的第一台Windows Server 2008/IIS7.5服务器上进行了设置.我一生都无法弄清楚如何完全关闭错误处理 >.我看到的唯一选项是:

I just got setup on my first Windows Server 2008 / IIS7.5 server for a contest I am participating in. I can't for the life of me figure out how to turn OFF error handling COMPLETELY. The only options I see are:

  • 自定义
  • 详细
  • 详细的本地,为远程自定义

我想完全关闭该功能,但我看不到有任何方法可以做到.我想念什么吗?

I want to turn the feature off completely, and I don't see any way to do that. Am I missing something?

我的情况:

我有一个RESTful PHP框架,该框架可以捕获异常并在尚未处理异常的情况下发出HTTP 500状态.然后,它将指定的异常消息放入响应正文中,并将其发送到浏览器.在Apache中这可以正常工作-发送正确的标头,并向用户显示消息.但是,在IIS中,始终会截获4xx和5xx HTTP状态代码的响应,并将其与其他准备好的消息或HTML文件一起注入,这恰恰是我不再希望它执行的操作.请帮忙!

I have a RESTful PHP framework that catches exceptions and emits an HTTP 500 status if the exception has not already been handled. It then puts the specified exception message in the response body and sends it to the browser. This works fine in Apache - the correct headers are sent and the message is displayed to the user. In IIS, however, the response for 4xx and 5xx HTTP status codes is always intercepted and injected with some other prepared message or HTML file, and that's exactly what I don't want it to do anymore. Please help!

推荐答案

经过更广泛的搜索,我在这里找到了答案:

After some more extensive searching, I found the answer here:

解决方案是使用此自定义"httpErrors"条目手动编辑 web.config 文件:

The solution is to manually edit your web.config file with this custom "httpErrors" entry:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough" />
    </system.webServer>
</configuration>

但是,由于IIS 7.0的锁定"功能,您可能会得到此配置节无法在此路径上使用.当该节被锁定在父级时会发生." 错误.要解决此问题,请在命令提示符下执行以下操作:

However, due to IIS 7.0 "lockdown" feature you might get a "This configuration section cannot be used at this path. This happens when the section is locked at a parent level." error. To solve that, execute the following in the command prompt:

cd C:\Windows\System32\inetsrv

appcmd unlock config /section:httpErrors

这篇关于关闭IIS7 HTTP错误处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆