如何在IIS 7的machine.config中注册HttpModule? [英] How do I register a HttpModule in the machine.config for IIS 7?

查看:139
本文介绍了如何在IIS 7的machine.config中注册HttpModule?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在服务器上的所有站点上安装HttpModule。如果我分别将正确的配置添加到每个站点的 web.config 文件中,它已经在GAC中并且可以在站点上运行。当我将配置移至 machine.config 或全局 web.config 时,该模块消失了。

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.

现在,我在 system.webserver / httpModules 中有配置32位和64位 machine.config 和全局 web.config 中的system.web / httpModules 部分code>-总共八个地方,没有一个在工作。

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.

我已经在 machine.config ,这很容易。

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

推荐答案

显然, machine.config 不负责定义 system.webServer 部分。实际上,它将该节定义为

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

请注意类型: System.Configuration.IgnoreSection

system.webServer 部分在

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

紧接 system.webserver 部分之后,有

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

这篇关于如何在IIS 7的machine.config中注册HttpModule?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆