httpModules不能在iis7上运行

我有以下模块

public class LowerCaseRequest : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(this.OnBeginRequest); } public void Dispose() { } public void OnBeginRequest(Object s, EventArgs e) { HttpApplication app = (HttpApplication)s; if (app.Context.Request.Url.ToString().ToLower().EndsWith(".aspx")) { if (app.Context.Request.Url.ToString() != app.Context.Request.Url.ToString().ToLower()) { HttpResponse response = app.Context.Response; response.StatusCode = (int)HttpStatusCode.MovedPermanently; response.Status = "301 Moved Permanently"; response.RedirectLocation = app.Context.Request.Url.ToString().ToLower(); response.SuppressContent = true; response.End(); } if (!app.Context.Request.Url.ToString().StartsWith(@"http://zeeprico.com")) { HttpResponse response = app.Context.Response; response.StatusCode = (int)HttpStatusCode.MovedPermanently; response.Status = "301 Moved Permanently"; response.RedirectLocation = app.Context.Request.Url.ToString().ToLower().Replace(@"http://zeeprico.com", @"http://www.zeeprico.com"); response.SuppressContent = true; response.End(); } } } } 

web.config看起来像

             

它适用于运行XP和IIS 5.1的PC

但是在我运行IIS7和WS 2008的网络服务器上没有用,请帮助我不知道如何解决这个问题。

谢谢

在IIS7及更高版本上使用

        

在IIS中转到function视图选择模块

双击模块然后右键单击并按(添加管理模块)

然后输入web.config定义的名称和类型

例:

    

以上对于IIS 7.5是正确的

    

我得到的唯一问题是应该将特定应用程序的应用程序池实例设置为托管Pipeline = Integrated,而不是Classic ..
或:使用经典模式

如果您的应用程序要使用经典模式,请确保为该类型的池配置了应用程序,并且您的模块在system.web部分中配置,而不是在web.config文件的system.webServer部分中配置。