[英]Configure managed httpmodule from GAC to work both in Classic and Integrated modes
I've developed a custom managed HttpModule (.NET 2), installed it on GAC and added it in Modules
section for IIS 8.5 globally. 我已经开发了一个自定义的托管HttpModule(.NET 2),将其安装在GAC上 ,并将其添加到IIS 8.5的“
Modules
部分中。
For each website with Integrated mode this module is visible in it's Modules section as Inherited and it works as designed for all .NET 2 and .NET 4 web applications (without manipulating each site's Web.Config
) . 对于每个具有集成模式的网站,此模块在其“模块”部分中都显示为Inherited ,并且按所有.NET 2和.NET 4 Web应用程序的设计工作(无需处理每个站点的
Web.Config
)。
As for websites in Classic mode , it's not there and therefore it's not accessible and working inside classic web application. 至于处于“ 经典”模式的网站,它不存在,因此无法访问并且无法在经典Web应用程序中运行。
I tried editing applicationHost.config
and Web.Config
(v2 and v4) in any way but I got no result (It seems Machine.Config
has no place for it). 我尝试以任何方式编辑
applicationHost.config
和Web.Config
(v2和v4),但没有任何结果(似乎Machine.Config
没有位置)。
How and where can I globally register that same module to handle classic mode without adding dll to bin and/or editing each website's Web.Config? 如何以及在哪里可以全局注册同一模块以处理经典模式,而无需将dll添加到bin和/或编辑每个网站的Web.Config?
OK it works now. 好的,现在可以使用。 For future reference:
备查:
I edited C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\Config\\machine.config
and got no response because IIS reads config from 64bit framework, so adding module inside C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Config\\machine.config
solved the problem. 我编辑了
C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\Config\\machine.config
,但没有响应,因为IIS从64位框架读取配置,因此在C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Config\\machine.config
添加模块C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Config\\machine.config
解决了该问题。
Alternatively for AppPools < .NET 4, C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\CONFIG\\machine.config
and C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\machine.config
must also be edited. 对于AppPools <.NET 4,也可以选择
C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\CONFIG\\machine.config
和C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\machine.config
也可以编辑。
For Integrated mode adding the custom module via IIS GUI to master Modules section is sufficient. 对于集成模式,通过IIS GUI将自定义模块添加到主模块部分就足够了。
As the result, one custom module installed on GAC is accessible for all .NET 2.0 + websites under IIS, Integrated and Classic, 32bit and 64bit with no need to edit each website's Web.Config separately. 结果,可以在IIS,Integrated和Classic,32位和64位下的所有.NET 2.0 +网站访问一个安装在GAC上的自定义模块,而无需分别编辑每个网站的Web.Config。
This is useful especially for hostmasters and server administrators to monitor websites' activities (Errors, DDOS attacks, etc) without direct intervention. 这对于主机管理员和服务器管理员无需直接干预即可监视网站的活动(错误,DDOS攻击等)特别有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.