2012-03-03 187 views
8

正在使用卡西尼,但切换到IIS Express。我最初的想法是,我可以删除所有<system.web>除之类的东西:为什么IIS Express使用<system.web>而不是<system.webServer>?

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

我以前customErrors都设置像这样:

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

我删除了这个customErrors元素,当我切换到IISExpress。现在404不再重定向到我很好的“NotFound”页面。

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

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

+1

的Visual Studio版本至极您使用的是?这[问题](http://stackoverflow.com/questions/3748466/how-to-switch-iis-developer-express-to-classic-mode)可以帮助。 – coseguera 2012-03-03 03:11:22

+0

2010在Windows 7 – 2012-03-03 05:03:12

+0

这是有趣的,因为IIS EXpress是基于使用system.webserver的IIS7代码库 – 2012-03-03 05:07:56

回答

7

嗯,我尝试了一些不同的东西:

  • 改变existingResponsePassThrough所指出here

    <httpErrors errorMode="Custom" existingResponse="Replace">

都能跟得上!

  • 设置TrySkipIisCustomErrors = false根据说明注释here

Notta!

我最终通过简单地将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> 

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

替换 - 该值进行自定义错误模块来随时更换 错误信息与自定义错误模块生成的文本。如果 existingResponse设置为“替换”,则由IIS7错误取代由Asp.Net/WCF 生成的错误/异常。

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

+1

同意,这没有任何意义。 +1为您的调试! – 2012-12-19 20:04:11

相关问题