ASP.NET URL 重写在开发服务器中有效,但在本地 IIS 中无效

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

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

我在 Global.asax (RouteTable.Routes.MapPageRoute) 中进行了 URL 重写。它可以在开发服务器中运行,但不能在 IIS 中运行。

IIS中有这样的配置吗?

最佳答案

有一个用于它的网络配置...您不需要需要删除/添加部分,这只是显示您如何显式包含此模块。

<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>

系统.web:

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

关于ASP.NET URL 重写在开发服务器中有效,但在本地 IIS 中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11892140/

相关文章:

.net - Sharepoint,IIS,.net和多线程

c# - 无法从解决方案访问 IIS Express 文件夹

asp.net - IIS URL动态重写方式

c# - 存在同名数据库,或无法打开指定文件,或位于 UNC 共享上

jquery - 如何使用 ASP 压缩 JSON?

html - Internet Explorer 中的字段集图例

asp.net - Asp.net 中 global.asax 和 Error 404 的 URL 重写

php - 使用 .htaccess/PHP 获取错误描述

asp.net - Css 代码仅在使用类时不起作用

JavaScript 运行时错误 : Unable to get property 'innerHTML' of undefined or null reference in asp. 网络