【发布时间】:2011-08-24 19:58:01
【问题描述】:
我有一个客户,他有一个网页,在 global.asax 中添加了自定义路由(它们是无扩展名的):
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Routing.RouteTable.Routes.Clear()
Routing.RouteTable.Routes.MapPageRoute("Key1", "String", "~/Route")
不幸的是,这种重定向在 IIS 7.5 上不起作用。我已经测试过了:
- HTTP 重定向是通过 IIS 安装的
- 尝试运行AllManagedModulesForAllRequests="true"(在web.config 中)
- 使用手动添加的 UrlRoutingMode (http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html)
池处于集成模式,4.0。这台服务器运行了很多 MVC3 页面,并且默认使用路由。
任何光线都会非常感激!谢谢
================================================ ========================
编辑:好的,我找不到任何解决方案。
在 webconfig 中,在程序集中:
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
在 system.webServer:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<defaultDocument>
<files><add value="Page.aspx" /></files>
</defaultDocument>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,System.Web.Routing,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
</modules>
</system.webServer>
【问题讨论】: