我有一个HttpModule
用于处理错误并在Visual Studio开发环境中运行。它运作良好。对于客户来说,有很难404
s和没有明显的重定向。 Google Analytics应该对此感到满意。HttpModule似乎仅针对静态页面触发
调试中Visual Studio 2008
,当一个导航到localhost:
[port]/this_page_doesnt_exist.html, I get a our 404 error page and the hard 404.
它也可以在开发服务器上
localhost:[port]/this_page_doesnt_exist.aspx.
当我端口的全是它给我们的IIS7
web服务器,我”它已经完全按照它应该为静态HTML文件工作。但是,我确定我的模块根本没有被调用,因为aspx
文件。如果我打开customErrors
Off
,我得到标准丑陋的404
页面。 (如果customErrors
是RemoteOnly
,这些都一命呜呼)
的线索似乎在一些IIS
设置,我没有正确地调整,以被人指指点点,但我不能为我的生命中找到它。有任何想法吗?
更多信息:
我在集成模式下运行,并且我web.config
包含以下几个部分:
<configuration>
<system.web>
<httpModules>
<add name="ErrorModule" type="HttpModules.ErrorModule, HttpModules"/>
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ErrorModule" preCondition="managedHandler" type="HttpModules.ErrorModule, HttpModules"/>
</modules>
</system.webServer>
</configuration>
然而更多信息
我还以为是发生在IIS7
不是发生了什么事。我看到服务器上的HTML文件的404
错误消息的唯一原因是CustomErrorHandler
本机模块正在获取它。当我关闭该模块时,现在我的ErrorHandler
运行aspx
文件,但不能用于HTML文件。
我一定要接近,但我一直在努力让我的设置剩下的路。任何人都可以把我推向球门线吗?
感谢您的建议。除了'precondition =“managedHandler”'之外,我在web.config中拥有了上述所有内容。不幸的是,添加该属性并没有改变行为。 – Brad 2011-01-27 16:02:22