MVC on IIS 6 – Using a Virtual Directory

Deploying an MVC application on a virtual directory on an IIS 6 server can be done with the below steps.

1.  Set up a virtual directory and copy the website files over to the server and configure it as you would a webforms or asp classic application.

2.  In IIS, Right click on Properties for the virtual directory of the MVC application.

3. Click the Virtual Directory tab and push the Configuration button.

4.  Under “Wildcard application maps (order of implementation)”,

Adding Wildcard Mapping

insert a mapping to the aspnet_isapi.dll. Your aspnet_isapi.dll file will most likely be in the directory: c:\windows\microsoft.net\framework\v2.0.50727

Ensure that “Verify that file exists” is unchecked.

Wildcard dialog

That should be all you need to do.



You may notice that CSS doesn’t work on your application.  If CSS is not working you may need to change your CSS file references to have a tilde character as below.

<link rel=”stylesheet” href=”~/Content/screen.css” type=”text/css” media=”screen” />

You may also notice that javascript is not working either.  To remedy this you can use MvcContrib and use the below code to reference javascript files:

<%=Html.ScriptInclude(“~/js/jquery.1.4.4.js”)%>

Many thanks to Phil Haack’s blog on this topic which provided me with some of the information used.

Advertisements
This entry was posted in Technical and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s