Deploy an ASP.NET MVC 2 Web site on IIS 6.0

Hey sports fans!

Today I was given the task of deploying my web site to my development machine. With MVC 2 plugged-in to Visual Studio 2008, it should have been a cinch (with VS2010 and IIS7, it IS), but I ran into some roadblocks I thought I'd blog about.

So all I thought I would have to do is right click the ASP.NET project in the solution explorer while the solution was open in Visual Studio, and click publish, and then specify the directory to publish it to. Visual Studio was supposed to do the rest. But ACTUALLY it was much tougher. First I had to open the properties of the ASP.NET project, and go to the "Web" tab, and set it to run on an IIS server instead of a development server. THEN I took the step of right clicking the project and (publish...)ing it. But everytime I tried to navigate to http://localhost/ it would give me a weird error saying the directory was inaccessible.

The problem was that IIS had no mapping for paths without extensions. you see "localhost" maps to "localhost/home/index", but what IIS was expecting was something that ends in ".aspx" - so IF "localhost" mapped to "localhost/home/index.aspx", then the page would display and everything would be peachy. But it didn't. So here's how you map something with NO file extension (i.e. a "wildcard" mapping). (I learned it from here: haacked

1.) Open up IIS from the start menu.

2.) Expand the tree so that your website's name is displayed (underneath "Default Web Site").

3.) Right click your website, and go to the properties.

4.) Click Configuration...

5.) Click Insert under "Wildcard application maps"

6.) Enter the location of your aspnet_isapi.dll file (find it by going back and Editing the .aspx file extension in the previous window)


7.) Fill in the other fields the same as in the above pic, and click ok

8.) Keep clicking ok until you're back at IIS. Now try the webpage and it should work!

Comments

Post a Comment

Popular Posts