Deploying an MVC4 Web application to Windows 2003

I had a hard time deploying an MVC4 application to Windows server 2003, so I thought I’d share my experience with you.

When deploying an MVC4-based website to Windows Server 2003, it is important to add Wildcard maps in Internet Information Services (IIS). The default IIS-configuration is based on extensions coupled to ISAPI-addins, but MVC doesn’t work with extensions so you need to tell IIS to have a ‘catch-it all’ extension. Here are the steps necessary to do so.

The target framework needs to be 4.0

If you develop a MVC4 website using Visual Studio 2012, the default .NET framework is 4.5. Windows 2003 doesn’t support the .NET framework 4.5 as you can read over here, so you need to downgrade the target framework to 4.0. You can easily do this with Visual Studio 2012 by changing the target framework in your project properties pages :

Target framework Visual Studio 2012 project

Target framework Visual Studio 2012 project

Installing the .Net 4 framework

The next step is to install the .NET framework 4.0. This comes in two flavours, the .NET 4 Framework Client Profile and the .NET 4 Framework which is the full framework. If you are deploying webapplications, you need the full framework, the Client Profile is a subset of the framework for desktop applications. You can read more about the differences over here. You can download the full redistributable of the .Net framework 4.0 at microsoft. After you installed the .NET 4.0 framework, you’ll see the following listing in installed programs :

.NET 4 framework installed

.NET 4 framework installed

The .NET 4 Framework Client Profile is the subset of the framework, the .NET 4 Framework Client Extended is the remainder making the full framework to be installed.

Configuring IIS to use .Net 4

After .NET 4 is installed, it is registered to IIS as an Web Service Extension, but it is not enabled by default:

ASP.Net 4.0 prohibited

ASP.Net 4.0 prohibited

Right click the ASP.Net v4.0.30319 line and select Allowed. After that, you should see the following screen :

ASP.Net 4.0 allowed

ASP.Net 4.0 allowed

Adding a Wildcard map

If you are deploying Web-Forms applications, then your done and your application should run. If you are working on MVC applications there’s one last step to do, you need to add a Wildcard map for your application. Go to IIS, select your project and choose Properties→Virtual Directory→Configuration and you’ll see the Application Configuration screen. In the lower part you can see a listing of installed wild card application maps, which is empty. You can add one by selecting the ‘Insert’ button:

Insert wildcard IIS map Virtual Directory

Insert wildcard map IIS Virtual Directory


The ‘Add/Edit Application Extension Mapping’ dialog shows up. In the Executable-text field, enter the path to the .NET Framework 4.0 isapi-extension which is normally c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll. Be sure to unselect the ‘Verify that file exist’-checkbox :

Add IIS wildcard

Add IIS wildcard


Choose ‘OK’ and close the screen. Your dialog should now look like this :

IIS Wildcard added

IIS Wildcard added


Close the screen, and your MVC4 application should now be ready to run!

This entry was posted in MVC4, Visual Studio 2012, Windows 2003 and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>