轉 IHttpModule不起作用
在 Visual Studio 中,測試 IHttpModule(httpModules) 正常,但是放到服務器上去就不起作用了,這多半得多服務器 IIS 配置入手。
一、看“應用程序池”的“托管管道模型”是否正確
要使用“集成”才正確,網上有說得用“經典”模式,但我測試得用“集成”模式。
二、web.config 配置是否適合 IIS 版本
在 IIS 7 以下的版本中,應用以下配置:
<system.web>
<httpModules>
<add name="Cftea.MyHttpModule" type="CfteaHttpModule程序集" />
</httpModules>
</system.web>
在 IIS 7 及以上的版本中,應用以下配置:
<system.webServer>
<modules>
<add name="Cftea.MyHttpModule" type="CfteaHttpModule程序集" />
</modules>
</system.webServer>

浙公網安備 33010602011771號