【问题标题】:Why is IIS Express using <system.web> and not <system.webServer>?为什么 IIS Express 使用 <system.web> 而不是 <system.webServer>?
【发布时间】:2012-03-21 12:31:46
【问题描述】:

使用 Cassini 但切换到 IIS Express。我最初的想法是我可以删除所有&lt;system.web&gt;,除了:

<authentication mode="Forms">
  <forms loginUrl="/" />
</authentication>

我之前的customErrors 是这样设置的:

<customErrors mode="On" defaultRedirect="/ServerError">
  <error statusCode="404" redirect="/NotFound" />
</customErrors>

当我切换到 IISExpress 时,我删除了这个 customErrors 元素。现在 404 不再重定向到我漂亮的“未找到”页面。

用于我的网站的 AppPool 是 Clr4IntegratedAppPool,这让我知道它没有使用 Classic。

为什么 IISExpress 如此依赖 system.web 而 IIS 7.5 使用 system.webServer?

【问题讨论】:

  • 您使用的是哪个版本的 Visual Studio?这个question 可以提供帮助。
  • 这很有趣,因为 IIS EXpress 基于使用 system.webserver 的 IIS7 代码库

标签: asp.net asp.net-mvc-3 iis-7.5 iis-express custom-errors


【解决方案1】:

好吧,我尝试了一些不同的方法:

  • 将existingResponse 更改为PassThrough,如here 所述

    &lt;httpErrors errorMode="Custom" existingResponse="Replace"&gt;

不!

  • 设置 TrySkipIisCustomErrors = false 如 cmets here

不是!

我最终只需将 existingResponse 更改为 Replace 即可使其工作。

  • 谁知道呢!

这就是system.webServer 现在的样子:

<httpErrors errorMode="Custom" existingResponse="Replace">
        <remove statusCode="404" subStatusCode="-1" />
        <error statusCode="404" path="/NotFound" responseMode="ExecuteURL" />
        <remove statusCode="500" subStatusCode="-1" />
        <error statusCode="500" path="/ServerError" responseMode="ExecuteURL" />
    </httpErrors>

为什么这个解决方案没有任何意义

Replace - 此值使自定义错误模块始终替换 自定义错误模块生成的带有文本的错误信息。如果 existingResponse 设置为“替换”,错误/异常由 Asp.Net/WCF 被 IIS7 错误替换。

http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx

【讨论】:

  • 同意,这没有任何意义。为您的调试 +1!
猜你喜欢
  • 2011-07-07
  • 2013-09-13
  • 2011-10-28
  • 1970-01-01
  • 2010-09-26
  • 2020-11-11
  • 1970-01-01
  • 2011-06-13
  • 1970-01-01
相关资源
最近更新 更多