How do I register a HttpModule in the machine.config for IIS 7?

房东的猫 提交于 2020-01-03 04:52:09

问题


I'm trying to install a HttpModule on all sites on a server. It is already in the GAC and is working on sites if I individually add the proper configuration to each site's web.config file. When I move the configuration into the machine.config or the global web.config, the module disappears.

Right now, I have the config in the system.webserver/httpModules and the system.web/httpModules sections in both the 32 bit and 64 bit machine.config and global web.config - eight places total and none of them are working.

I've installed modules in the machine.config on IIS6 before and it is easy. Is there a trick for installing them in IIS7?


回答1:


Apparently, the machine.config is not responsible for defining the system.webServer section. In fact, it defines the section as

<section name="system.webServer" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Note the type: System.Configuration.IgnoreSection.

The system.webServer section is defined in

%windir%\system32\inetsrv\config\applicationhost.config

Directly after the system.webserver section, there is

<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>


来源:https://stackoverflow.com/questions/8657335/how-do-i-register-a-httpmodule-in-the-machine-config-for-iis-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!