ExistingResponse =" PassThrough"在IIS中意味着什么 [英] What does existingResponse="PassThrough" mean in IIS?

查看:462
本文介绍了ExistingResponse =" PassThrough"在IIS中意味着什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档说


existingResponse =PassThrough

如果存在现有响应,则保持响应不变。
http://www.iis.net/configreference/system.webserver/httperrors#005

Leaves the response untouched if an existing response exists. http://www.iis.net/configreference/system.webserver/httperrors#005

但现有的回应是否存在是什么意思?

But what does that mean by "existing response exists"?

例如我希望我的 customErrors 处理程序禁止ASP.NET响应,以便IIS认为响应不存在。我该怎么做?

E.g. I want my customErrors handler to suppress the ASP.NET response, so that IIS would think that response doesn't exist. How would I do that?

推荐答案

模式有三种可能的值:

<attribute name="existingResponse" type="enum" defaultValue="Auto">
  <enum name="Auto" value="0" />
  <enum name="Replace" value="1" />
  <enum name="PassThrough" value="2" />
</attribute>

粗略地说,我理解这一点:

Roughly, here is how I understand this:

PassThrough - 只要有现有的响应,就会单独留下现有的响应。您的应用程序逻辑可能不会返回任何内容。在这种情况下,使用此处定义的错误页面。

PassThrough - leaves the existing response alone, as long as there is one. It is possible that your application logic doesn't return anything. In that case the error page defined here is used.

自动 - 使用此节点中定义的IIS错误页面,除非在asp中。你设置的净值:

Auto - uses the IIS error pages as defined in this node except when in asp.net you did set:

Response.TrySkipIisCustomErrors = true;

如果您已经这样做,则会使用您代码的响应。

if you've done that, the response from your code is used.

替换 - 始终使用IIS错误页面,即使开发人员设置了 TrySkipIisCustomErrors

Replace - always uses the IIS error pages, even if the developer has set TrySkipIisCustomErrors.

最后一个选项似乎是你想要的。

The last option seems to be the one you want.

编辑:

考虑:

existingResponse="PassThrough"

现在尝试打开一个不存在的asp.net页面,你会看到:

now try to open a non-existing asp.net page, you'll see:

即使资源不存在,运行时也会提供响应,然后传递给浏览器。

Even though the resource was not there, the runtime provided a response, it is passed through to the browser.

现在,试试打开一个不存在的html页面。这次我们仍然获得404状态但是空页。

Now, try to open a non-existing html page. This time we still get a 404 status but an empty page.

更改为:

existingResponse="Auto"

缺少的asp.net页面仍显示asp。净错误页面,但对于缺少的html页面,我们现在获得IIS一个:

the missing asp.net page still displays the asp.net error page, but for the missing html page we now get the IIS one:

所以,总结一下:查看缺少的html和aspx页面时使用不同的
existingResponse 值,我们得到不同的错误页面:

So, summarizing: when looking at missing html and aspx pages with different existingResponse values, we get different error pages:

                .html-404   .aspx-404   .aspx-500
--------------------------------------------------
Auto             IIS         asp.net    asp.net
PassThrough      -           asp.net    asp.net
Replace          IIS         IIS        IIS

这篇关于ExistingResponse =&quot; PassThrough&quot;在IIS中意味着什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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