asp.netiisurl-rewritingiis-7.5aspnet-development-server

ASP.NET URL-rewriting works in Development Server but not in local IIS


I'm programming ASP.NET using visual studio 2010 and IIS 7.5

I have URL-rewriting in Global.asax (RouteTable.Routes.MapPageRoute). It works in Development Server but not in IIS.

Is there a configuration for this in IIS?


Solution

  • There's a webconfig for it... You don't need the remove/add part, that's just showing how you'd explicitly only include this module.

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