如何在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.configsystem.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>