自定义 HttpModule 在 vs 2012 中不起作用



我通过嵌入IHttpModule接口编写了一个自定义HTTPModule。然后我在web.config文件中注册了它

<configuration>
  <system.web>
    <httpModules >
      <add name="AuthHttpModule" type="AuthHttpModule" />
    </httpModules>
  </system.web>
</configuration>

但是当我尝试访问任何页面时会抛出错误

检测到在集成中不适用的 ASP.NET 设置 托管管道模式。

注意:我使用的是VS2012和C#。

如果您使用的是集成模式,请在system.webServer而不是system.web中配置处理程序和模块。

<configuration>
    <system.webServer>
      <handlers>
      </handlers>
      <modules>
      </modules>
    </system.webServer>
</configuration>

如果要使用现有设置,可以使用"经典模式"。

最新更新