【问题标题】:ASP.NET URL-rewriting works in Development Server but not in local IISASP.NET URL 重写在开发服务器中有效,但在本地 IIS 中无效
【发布时间】:2012-08-07 04:38:42
【问题描述】:

我正在使用 Visual Studio 2010 和 IIS 7.5 对 ASP.NET 进行编程

我在 Global.asax (RouteTable.Routes.MapPageRoute) 中有 URL 重写。它适用于开发服务器,但不适用于 IIS。

在 IIS 中有这样的配置吗?

【问题讨论】:

    标签: asp.net iis url-rewriting iis-7.5 aspnet-development-server


    【解决方案1】:

    有一个 webconfig 用于它...您不需要 删除/添加部分,这只是显示您如何明确地包含此模块。

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
          <remove name="UrlRoutingModule" />
          <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </modules>
        <handlers>
          <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </handlers>
      </system.webServer>
    

    system.web:

     <httpModules>         
          <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     </httpModules>
    

    【讨论】:

    • 实际上只是 成功了。
    • 是的,这只是演示这个特定模块的显式调用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 2017-08-16
    • 1970-01-01
    • 2011-07-30
    • 1970-01-01
    • 2013-01-25
    • 1970-01-01
    相关资源
    最近更新 更多