Running ASP.NET MVC on IIS6

by Juan 23. February 2009 10:07
Share on Facebook

I wanted to try out ASP.NET MVC in order to decide whether or not I could use it for a small project I’m starting, I’ve read nothing than good things about the Framework, but I hadn’t had the chance to try it on a real web site.

The first step though, is making it work. My hosting provider runs the windows server on IIS6, and does not allow custom configuration unless you buy a dedicated server, which I didn’t want to do, for now at least.

There are quite a few blog posts that explain how to run ASP.NET MVC on IIS6, but in all I read you need to have access to the web server configuration, to do one of two things:

This options were no good for me.

The solution was quite simple (well, it became simple after a little bit of research): Add a custom route, and map .aspx files to a controller.

You need to add this to the Global.asax file:

 routes.MapRoute("Main", "{controller}/{action}.aspx",
     new { controller = "Home", action = "Index" });
 
 routes.MapRoute("Default", "",
     new { controller = "Home", action = "Index" });

The only drawback is that you don’t get the “pretty” url you can get if you use IIS7 or have access to IIS6 configuration, but it works.

(Instead of having a url like this: http://yourserver/Home/Index, you get http://yourserver/Home/Index.aspx)

If the framework (MVC) is not installed on the server, you also need to copy the dlls to the bin directory, which they don’t get copied by default, you need to check the “Copy Local” property in the project references.

Tags: , , ,

Programming | Tips

Powered by BlogEngine.NET 1.4.5.15
Theme by Mads Kristensen Modified by Juan Manuel Formoso

About the Author

Juan Manuel
Networking
View my LinkedIn profile View my Facebook profile View my Twitter feed View my StackOverflow CV

Juan Manuel Formoso
There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something more bizarrely inexplicable.

There is another theory which states that this has already happened.

E-mail me Send mail

Hosting is not Free

Google Reader Picks

Most comments

Cristian Cristian
1 comments
co Colombia

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent comments

Comment RSS

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008