【问题标题】:How to determine what IIS module is executing to set preCondition?如何确定正在执行什么 IIS 模块来设置前置条件?
【发布时间】:2014-04-23 14:13:31
【问题描述】:

我已将 Web API 添加到 Web 表单应用程序中。

<system.webServer>
  <modules>
    <remove name="UrlRoutingModule-4.0"/>
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition=""/>
  </modules>

我在 Global.asax.vb 中有一些代码:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
    ' Fires at the beginning of each request
End Sub

我不想为它创建一个单独的模块。当我向 Web API 发出请求时,此代码在 IIS 7.5 (Windows 7) 中运行良好。但是,该事件不会在 IIS 7.0 (Windows Server 2008) 中触发。

IIS 7 模块:

我发现使用 runAllManagedModulesForAllRequests="true" 一切都很好:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
    <remove name="UrlRoutingModule-4.0"/>
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition=""/>
  </modules>

但是,我想通过为特定的 HTTP 模块显式设置 preCondition="" 来摆脱这个参数。

我不知道需要添加什么模块。怎么找?

【问题讨论】:

    标签: asp.net iis asp.net-web-api web-config


    【解决方案1】:

    通过安装KB980368 hotfix 解决了这个问题。

    我的服务器安装了所有实际的 Windows 更新。我认为我不需要修补程序。

    【讨论】:

    • 谢谢,这也解决了我们的问题。花几个小时研究我们的 Windows Server 2008 IIS 7 机器和开发 Windows Server 2008 R2 IIS 7.5 机器之间的 IIS 和网站配置差异
    猜你喜欢
    • 1970-01-01
    • 2016-08-12
    • 1970-01-01
    • 2015-11-20
    • 1970-01-01
    • 1970-01-01
    • 2019-10-29
    • 1970-01-01
    • 2020-05-29
    相关资源
    最近更新 更多