Compartilhar via


System.Web.Routing RouteTable not working with IIS?

Most of the time I write simple apps that run in the local ASP.NET development server.  I noticed when I started working with IIS more because of Windows Server AppFabric that my routes were not working when the web application is deployed in IIS.

For Visual Studio 2010 / .NET 4 and IIS 7.5 here is what I’ve learned.

Step 1 - Make sure that you have installed the HTTP Redirection feature

This one was the killer for me.  I didn’t realize that this is not setup by the Web Platform Installer.

SNAGHTMLa5d9ce

Step 2 - Modify your web.config

You are going to need the following

   <system.webServer>

    <modules runAllManagedModulesForAllRequests="true">

      <remove name="UrlRoutingModule"/>

      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

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

 

Step 3 - Create your routes

 RouteTable.Routes.Add(

    new ServiceRoute("AdventureWorks",

                        new DataServiceHostFactory(),

                        typeof(AdventureWorks)))

Comments

  • Anonymous
    June 29, 2010
    In this walkthrough I’ll show you how to use the AppFabric-enabled WCF Data Service template for Visual

  • Anonymous
    June 30, 2010
    In this walkthrough I’ll show you how to use the AppFabric-enabled WCF Data Service template for Visual

  • Anonymous
    June 30, 2010
    In this walkthrough I’ll show you how to use the AppFabric-enabled WCF Data Service template for Visual

  • Anonymous
    June 30, 2010
    In this walkthrough I’ll show you how to use the AppFabric-enabled WCF Data Service template for Visual

  • Anonymous
    June 30, 2010
    In this walkthrough I’ll show you how to use the AppFabric-enabled WCF Data Service (C#) template

  • Anonymous
    June 30, 2010
    In this walkthrough I’ll show you how to use the AppFabric-enabled WCF Data Service (VB) template for