不是的HttpModule与Visual Studio运行 [英] HttpModule not running with Visual Studio
问题描述
我使用一个HttpModule做我的网站上某些URL缩短。我使用Visual Studio 2008和IIS 7和.Net 3.5。
I am using an HttpModule to do some URL shortening on my site. I am using Visual Studio 2008 and IIS 7, and .Net 3.5.
当在 system.webServer web.config中的元素指定的模块,而该网站是在IIS中运行,它工作正常。这个配置是这样的:
When the module is specified in the system.webServer element of web.config, and the site is run in IIS, it works fine. The config looks like this:
<system.webServer>
<modules>
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule" />
</modules>...
我的模块附着到BeginRequest事件,一切正常。但是,我不能得到它使用内置的VS web服务器(卡西尼)运行。我试过模块配置移动到的System.Web 元素在web.config中,没有运气。我把一个断点就可以了,没有任何反应。
My module attaches to the BeginRequest event, everything works. However, I can't get it to run using the built-in VS web server (Cassini). I tried moving the module config to the system.web element in web.config, no luck. I put a breakpoint on it, nothing happens.
这是为什么这会是一个问题,有什么想法?
Any thoughts on why this would be an issue?
(我也试过在Global.asax中的Application_BeginRequest事件。仍然没有运气,不过我倒是preFER保持在web.config中的一切反正。)
(I also tried the Application_BeginRequest event in global.asax. Still no luck, though I'd prefer to keep everything in web.config anyway.)
推荐答案
卡西尼,IIS提供的开发Web服务器使用IIS6模块的语法,所以你必须复制模块添加像这样
Cassini, the development web server provided with IIS uses the IIS6 module syntax, so you must duplicate the module add like so
<system.web>
<httpModules>
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="MinimizeModule" />
<add name="MinimizeModule" type="ClipperHouse.UrlMinimizer.MinimizeModule"
preCondition="managedHandler" />
</modules>
</system.webServer>
请注意,我还添加了一个precondition您IIS7设置
Note that I've also added a precondition to your IIS7 settings
这篇关于不是的HttpModule与Visual Studio运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!