如何在machine.config中为IIS 7注册HttpModule?
问题描述:
我试图在服务器上的所有站点上安装HttpModule。如果我单独为每个网站的web.config
文件添加适当的配置,它已经在GAC中并正在网站上工作。当我将配置移动到machine.config
或全局web.config
时,模块消失。如何在machine.config中为IIS 7注册HttpModule?
现在,我在system.webserver/httpModules
的配置,并同时在32位和64位machine.config
和全球web.config
的system.web/httpModules
部分 - 八强名额总数和他们都不工作。
我已经在IIS6上安装了machine.config
中的模块,而且很容易。有没有把它们安装在IIS7中的技巧?
答
显然,machine.config
不负责定义system.webServer
部分。实际上,它将该部分定义为
<section name="system.webServer" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
请注意类型:System.Configuration.IgnoreSection
。
的system.webServer
部是部分之后在
%windir%\system32\inetsrv\config\applicationhost.config
直接定义,存在
<location path="" overrideMode="Allow">
<system.webServer>
<modules>
<!-- add the module here -->
<add name="MyModule" type="MyNamespace.MyModule, MyAssmebly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcdefhijklmnop"/>
</modules>
</system.webServer>
</location>