为什么我的 machine.config HttpModule 没有在我的 Web 应用程序中运行?
我在 .NET 3.5、32 位 Win 2003、IIS 6 中编写了一个 HttpModule
,效果非常好。它的程序集位于 GAC 中,配置位于 machine.config 中。多年来一切都很好。
我只是将其全部转移到新的 .NET 2-4、64 位 Win 2008 R2、IIS 7.5 计算机上,并将相同的旧配置放入 machine.config
中。不幸的是,该模块未列为网站上运行的模块。当我将配置直接放入站点的 web.config
中时,它会按预期运行。 为什么我的应用程序没有从 machine.config
继承 HttpModule?
此配置在 machine.config 中不执行任何操作,但在 Web 中按预期工作。
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="MyModule" type="MyModule, MyAssmebly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcdefghijklmno" />
</modules>
</system.webServer>
我将配置放在每个可能的 machine.config 文件中都无济于事:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
C :\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
更新
配置的其他元素继承到 web.config:例如,system.web\compilation
和system.serviceModel\bindings
。该模块使用在 machine.config
中配置的 WCF。它似乎只是没有被继承的HttpModule
。不,任何地方都没有
。
I wrote a HttpModule
in .NET 3.5, 32 bit Win 2003, IIS 6 that worked great. Its assemblies were in the GAC and the config was in the machine.config
. Everything has been great for years.
I just brought it all over to a new .NET 2-4, 64 bit Win 2008 R2, IIS 7.5 machine and put the same, old configuration in the machine.config
. Unfortunately, the module isn't listed as those that are running on the site. When I put the configuration directly into a site's web.config
, then it runs as expected. Why isn't my app inheriting the HttpModule from the machine.config
?
This config does nothing in the machine.config, but works as expected in the web.config.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="MyModule" type="MyModule, MyAssmebly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcdefghijklmno" />
</modules>
</system.webServer>
I put the config in every possible machine.config file to no avail:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG
UPDATE
Other elements of the configuration are inherited to the web.config: system.web\compilation
and system.serviceModel\bindings
to name a couple. The module uses WCF that is configured in machine.config
. It appears to just be the HttpModule
that isnt being inherited. No, there is no <clear/>
anywhere.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,machine.config 不负责定义 system.webServer 部分。事实上,它将节定义为
注意类型:
System.Configuration.IgnoreSection
。system.webServer
部分定义在system.webserver
部分之后,有Apparently, the
machine.config
is not responsible for defining thesystem.webServer
section. In fact, it defines the section asNote the type:
System.Configuration.IgnoreSection
.The
system.webServer
section is defined inDirectly after the
system.webserver
section, there is