Tag Archives: iis5

ASP.NET MVC – Deploying on Win XP

This is the second in a series of posts about things I found out while learning ASP.NET MVC. Today : Setting up your development XP machine to run your site.

This is actually quite a simple one, but be warned, the overhead of setting up IIS5 to run an MVC site may lead to trouble if you put it under heavy load.

First, you’ll have to add a new Route to your Global.asax.cs file, just for IIS5.  For example :

 

routes.MapRoute(
      "IIS5",  // Route name
      "{controller}.mvc/{action}/{id}",  // URL with parameters</strong>
      new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
);

Note in this example that the only difference (apart from the name) is the addition of a “.mvc” extension after the controller declaration.

Now, you just need to configure your IIS virtual directory.

In inetmgr, navigate to your virtual directory, right click it and select Properties.  On the default tab (“Directory”), click the Configuration button.  You now need to add a new file extension handler, so click on the “Add” button.

In the textbox for the executable, enter the path to aspnet_isapi.dll ([probably C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll), and set the extension to be “.*”.  Before you hit “OK”, make sure you untick the box marked “Check that file exists”.  Now you can hit OK a few times and you’re good to go.