Host MVC App on IIS 5.1 (XP Professional)
Using the ASP.NET routing for MVC IIS 7.0 is supposed to work very nicely. Sadly, we don’t have the budget for Windows 2008 server yet. So, I had to look around for ways to kludge the routing for my XP machine.
Fortunately Microsoft has some really clear directions for IIS 6. You can see them here: http://www.asp.net/learn/mvc/tutorial-08-cs.aspx
Translating that to IIS 5.1 is not too hard. To start with, create your MVC app. Test it, make it work in the Visual Studio debugger, etc.
1. Create a virtual directory in IIS. To do this, right click on your Default Website, select “New”, then select “Virtual Directory”. Walk through the virtual directory wizard.
2. Now, you need to create an application mapping for your MVC application. Right click on the virtual directory and select “Properties”.This will load the properties for the virtual directory.Click on the “Virtual Directory” tab and then find the “Configuration” button … click that to load the application configuration applet.
3. Click on the “Mappings” tab, then click on the “Add” button to add an application extension mapping.The executable needs to point at the aspnet_isapi.dll. That is found in the C:WINDOWSMicrosoft.NETFrameworkv2.0.50727 directory.
There is some wierd little bug in that form so you have to click back inside the executable text box after you navigate to the .dll and select it. Otherwise the “OK” button stays grayed out, i don’t know why it does it or why click back into the box works, but it does. For extension, put “.*” and make sure that “Check that file exists” is unchecked.
That was all i needed to do. My Global.asax RegisterRoutes function looks like this when i begin my app.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
References :
http://blog.davidrenz.com/?p=418
No comments:
Post a Comment