Skip to main content

Running an ASP.NET MVC 3 app on a web server that doesn’t have ASP.NET MVC 3 installed

Some Background

We support two ways for you to install and use the assemblies that implement ASP.NET MVC 3 on a machine:
  1. Have the ASP.NET MVC 3 assemblies installed in a central place on a machine, and have web projects reference/use the assemblies from there
  2. Copy the ASP.NET MVC 3 assemblies into the \bin folder of your web project, and have your web project reference/use the assemblies from there
The first approach is the default approach we use with Visual Studio, and has the benefit of enabling us to easily service the ASP.NET MVC 3 assemblies using Windows Update (in the event of a bad bug).
The second approach is also fully supported, and has the benefit of not requiring ASP.NET MVC 3 to be explicitly installed on a machine in order for it to be used.  Instead you can just copy/ftp your web application onto a server (with the ASP.NET MVC assemblies contained within the \bin directory of the application) and it will just work.  You should use this second approach if your web hosting provider hasn’t explicitly installed ASP.NET MVC 3 yet on their servers.

Approach 1: GAC Based Referencing of ASP.NET MVC Assemblies

When you install ASP.NET MVC 3 on a machine, a number of assemblies are automatically registered in the GAC (global assembly cache) as part of the installation process.  The GAC provides a central place that .NET assemblies can be installed and serviced (via Windows Update).  Because it provides an easy way for us to update/service assemblies, ASP.NET MVC projects - by default - reference the assemblies that implement ASP.NET MVC 3 from it. 
If you copy a vanilla ASP.NET MVC 3 project – that uses the default approach of referencing the ASP.NET MVC 3 runtime assemblies using the GAC – onto a machine that has not had ASP.NET MVC 3 installed on it, then you will see an error message like below when you run your application:
The above error indicates that one of the assemblies required to run ASP.NET MVC 3 from the GAC cannot be found.  Installing ASP.NET MVC 3 on the machine will fix it and allow your application to be run.

Approach 2: \Bin Directory Based Referencing of ASP.NET MVC Assemblies

The alternative approach your projects can use is to distribute and reference the ASP.NET MVC 3 runtime assemblies from the \bin directory of your web application.  The benefit of this approach is that you do not need to explicitly install ASP.NET MVC 3 on a machine in order to run your web application.  Instead, you can just copy/ftp your web application onto an existing .NET 4 server and it will work.  This approach works for both “full trust” and “medium trust” scenarios – which means it will even work with low-cost shared hosting offers.  No addition registration/installation/action is required by the hosting provider in order to enable this.
Enabling your web project to “bin deploy” the ASP.NET MVC 3 assemblies is easy and only takes about 2 minutes to do.  Here are the steps to follow:
Once configured for \bin based deployment, an application you build with ASP.NET MVC 3 will work on any web server that has .NET 4 installed on it.  Just copy/ftp it up to the web-server and it will run.  You don’t need the hosting provider to do anything to enable it – this is true even for low-cost shared hosting accounts.  

Finding a ASP.NET Web Hosting Provider

You can browse the Windows Web Hosting Gallery to find good ASP.NET based Windows Hosting Providers (all of which support ASP.NET 4):
The Windows Web Hosting Gallery allows you to filter/browse hosting offers by different countries and service level offerings.  It also allows you to easily filter by “Shared Hosting”, “Virtual Hosting” and “Dedicated Hosting” offers.
“Shared Hosting” refers to an offer where many customers run on a single web-server and you do not have admin access on the remote server.  “Virtual Hosting” offers provide you with your own Virtual Machine image on a remote-server – typically with OS admin rights and remote terminal server access to manage it.  “Dedicated Hosting” offers provide you an entire physical server, and also typically provide OS admin rights and remote terminal support to it.
The prices for Windows based web hosting are now very cost effective, and start from as little as $2.75/month for a shared hosting offer and $23/month for a virtual hosting offer.  All of the above offers are capable of running ASP.NET MVC 3 using the \bin deployment approach.


You can deploy ASP.NET MVC 3 based applications to any web-server that has .NET 4 enabled on it – without having to wait for the hosting provider to explicitly install ASP.NET MVC 3 on it.  Simply use the steps above to convert your project to use \bin based deployment of the ASP.NET MVC 3 assemblies, and then you can copy your application onto any ASP.NET 4 based server and it will just work.
Hope this helps,


Popular posts from this blog

Top 5 Women Who Impacted Technology in 2010

Katie Stanton, International Strategist for Twitter Katie Stanton has impressively long names of companies in her resume. They include the White House, Google Inc, and her latest addition is Twitter. Her remit is working on Twitter’s international strategy and her experience in social media will be a key asset to the company. Katie has a history of working in technology, and her knowledge of departmental laws will help Twitter work alongside government agencies, as she’ll be spearheading the free information approach, especially after the Wikileaks incident. Stanton has been a key player in the techsphere for some time, and this extends to her private life. Following the Haiti disaster she worked with a group of engineers to create a free texting service to help those in need and she is constantly in demand as an expert in both social media and government policy.
Caterina Fake, Co-Founder of Flickr and Hunch Despite having a surname which sounds like a pseudonym for a spy (it’…

AT&T MiFi 2372 review

In the week or so that I have been testing the AT&T MiFi 2372 by Novatel Wireless, it has already saved no less than three lives. First, it saved my cable guy’s life. You see, Time Warner Cable provides the worst home Internet service I have ever experienced. I can’t even think of a close second. If providing terrible home Internet service was a sport, Time Warner Cable would be on its tenth consecutive undefeated season. Forget the fact that my upload speed is capped at 60Kbps and I’m lucky if I can get half that — it has been months since I’ve gone through a full day without at least one service interruption. Months. Unfortunately, Time Warner Cable has an exclusive contract with my building so I have no choice but to endure its abysmal service. Last week, as a Time Warner Cable technician entered my home for the sixth time in two months, I realized that this certainly would have spelled serious trouble had it not been for my trusty new back up device. Before the Mi…

Evolution Of Computer Virus [infographic]