【发布时间】: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