Asp.net mvc 3 WebMatrix不考虑自定义QueryStringModule(httpModules)

Asp.net mvc 3 WebMatrix不考虑自定义QueryStringModule(httpModules),asp.net-mvc-3,query-string,httpmodule,webmatrix,iis-express,Asp.net Mvc 3,Query String,Httpmodule,Webmatrix,Iis Express,我根据此处找到的QueryStringModule创建了一个QueryStringModule: 当我使用VS2010调试器运行我的web应用程序时,它可以正常工作,但当我通过WebMatrix访问我的web应用程序时,它没有被考虑在内 下面是我如何在web.config文件的system.web部分注册它的: <httpModules> <add name="QueryStringModule" type="MyProject.Lib.HttpModules.Query

我根据此处找到的QueryStringModule创建了一个QueryStringModule:

当我使用VS2010调试器运行我的web应用程序时,它可以正常工作,但当我通过WebMatrix访问我的web应用程序时,它没有被考虑在内

下面是我如何在web.config文件的system.web部分注册它的:

<httpModules>
  <add name="QueryStringModule" type="MyProject.Lib.HttpModules.QueryStringModule" />
</httpModules>


关于WebMatrix为什么不使用我的QueryStringModule有什么线索吗?我的网站是一个使用EF 4.1的ASP.Net MVC 3项目。

WebMatrix使用IIS Express 7.5服务器,默认情况下,它以“集成”管道模式运行(在WebMatrix网站设置中,您可以看到“.Net 4(集成)”。您有以下两种选择

备选案文1: 保持web.config文件不变(即经典模式http模块注册),并将管道模式更改为经典模式

  • 在WebMatrix中打开您的站点
  • 在webMatrix中导航到站点设置
  • 更改.Net Framework版本,如下所示
  • 备选案文2: 不要更改站点的管道模式,而是更新web.config文件以在集成模式下注册HTTP模块(您的web.config应该如下所示)。查看以了解有关http模块注册的更多信息

    <configuration>
      <system.webServer>
        <modules>
           <add name="QueryStringModule" type="MyProject.Lib.HttpModules.QueryStringModule" />
        </modules>
      </system.webServer>
    </configuration>
    
    
    
    在选项2中,您向我显示的Web.config文件部分与我发布的部分相同。我的Web.config文件中有,但它不起作用。我是不是错过了什么?不一样。。。您的配置文件包含“httpModules”元素而不是“modules”,而且我假设您的配置文件包含“system.server”,而不是“system.webServer”。太好了!它正在工作。我没有注意到你指出的差异。我的文件已经有system.webServer部分,但是它的modules部分是空的。