Deployment of ASP.Net MVC 3 RC 2 Application on a Shared Hosting Environment Without Begging The Hosting Company

After the release of ASP.Net MVC RC 2, we are now waiting for the RTM release but some of us wanna use RC 2 already... But how to deploy it on a shared hosting acount is the mind-exploding problem...
2010-12-18 14:41
Tugberk Ugurlu


UPDATE on 2011, 02.26

I have wrote another blog post on ASP.NET MVC Deployment problems you might have related to your server. If you are still having problems (especially, if you are getting 404 exceptions for extensionless URLs), you might want to have a look at on "Running ASP.NET MVC Under IIS 6.0 and IIS 7.0 Classic Mode : Solution to Routing Problem"

asp-net-mvc-3.gifOn the 10th of December in 2010, Microsoft ASP.Net MVC team has released the MVC 3 RC 2 and it has some good stuff inside which RC 1 didn't have. It is not so much different but there are some breaking changes, especially ViewBag thing.

You could find more information about ASP.Net MVC RC 3 goodies on ScootGu's blog post or Phil Haacked blog post.

The MVC 3 RC 2 has come from go-live-license so you can use this in production if you wish. But the main problem rises here if you are in a shared hosting environment. As you know, shared hosting providers are not willing to install the new releases unless it is for sure that there is no detected bug in the package.

I thought that would be a big problem for me [because I am still in shared hosting environment :)] but deploying the necessary assemblies as manually is the solution. Scott Hanselman has a great post on how to deploy an MVC 3 application into a shared hosting environment. The article covers all the necessary steps. One problem is that if you do exactly as it is there, you will sure have a problem if you are deploying the RC 2 of the MVC 3.

The yellow screen of death will give you the following error;

Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

The error will be thrown by the system because it needs System.Web.WebPages.Deployment.dll as well. The solution of this little problem is simple;

Navigate to C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies (this could be C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies on Windows 7) inside the windows explorer and you will see some files inside the folder;

asp.net-mvc-3-rc-2-bin-deployment-shared-hosting-environment-full.PNG

You need those 6 dll files. In addition to that you will also need System.Web.Mvc.dll (version 3.0.11209.0). You will be able to find that dll file by navigating to C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies (that should be C:\Program Files (86x)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies in Windows 7 [I'm not sure though])

asp.net-mvc-3-rc-2-bin-deployment-shared-hosting-environment-mvc-folder.PNG

Finally you should all have the following dlls in hand;

  • Microsoft.Web.Infrastructure
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Razor
  • System.Web.Helpers
  • System.Web.WebPages.Deployment (If you are deploying MVC RC 2, this assembly is necessary to deploy)
  • System.Web.Mvc

I made a copy of those dlls and put them together inside a folder so that I could reach them easily whenever I need them;

essential-MVC-3-0-RC-2-with-razor-dlls.PNG

We have all the necessary files in our hands and so what now !

There are some conventions here that you could choose. The way I follow is that;

  • I used built in Visual Studio Publish tool to publish my application to the production side.
  • After publishing was complated, I simply copied those 7 dll files into the bin folder inside the root directory of my application.

visual-studio-2010-publish-tool-goodies.png
Visual Studio 2010 Publish Tool

That was it ! [Of cource I didn't put the System.Web.WebPages.Dployment.dll into the production side and I got the error firstly :)]

Finally, my bin folder has the necessary assembly files to run the application;

magic-bin-folder-of-asp-net-mvc-3-rc-2-application.png



Comments

Kevin
by Kevin on Tuesday, Dec 28 2010 13:42:52 +02:00

I have a running mvc website inside a shared hosting environment thanks to this post.

C++ Source Code Directory
by C++ Source Code Directory on Monday, Jan 17 2011 09:47:45 +02:00

Appreciate the research.

Haris
by Haris on Wednesday, Jan 26 2011 22:37:52 +02:00

really solved m problem thanks ! do you know how we could make it possible to publish the neccessary all 7 dll filles while we are publishing the site with VS 2010 publish tool ??

Thanks

Haris

Tugberk
by Tugberk on Wednesday, Feb 09 2011 22:11:23 +02:00

[quote]

[user]

CCNA training

[/user]

Nice article, I am a big time fan of your site, keep up the nice work, and I will be a frequent visitor for a very long time.

[/quote]

Thanks. glad that it helped. hope to see your comments often.

nihan
by nihan on Tuesday, Feb 15 2011 22:22:59 +02:00
Thanks...
link building services
by link building services on Thursday, Feb 24 2011 08:57:24 +02:00

Its very interesting.keep it up.I found many interesting points it contains a lot of information.

Stuart
by Stuart on Tuesday, Mar 15 2011 07:21:03 +02:00

thanks a LOT for sharing this valuable discussion!

Gideon
by Gideon on Wednesday, May 18 2011 16:55:33 +03:00

thanks man really saved me some hair

Gideon
by Gideon on Wednesday, May 18 2011 16:56:25 +03:00

thanks man really saved me some hair

tugberk
by tugberk on Wednesday, May 18 2011 17:53:58 +03:00

@Gideon

:) glad that it helped. consider looking at the following one as well for possible future complications;

http://tugberkugurlu.com/archive/running-asp-net-mvc-under-iis-6-0-and-iis-7-0-classic-mode---solution-to-routing-problem

jual emping
by jual emping on Monday, Nov 14 2011 06:24:22 +02:00

I am glad to read your post and to be part of it. I will be back to check more of your post.

Matt
by Matt on Tuesday, Feb 14 2012 01:37:34 +02:00

I'm getting this deployment excpt its asking for version 2.0 and im running it on my local machine. any thoughts ? Thanks 

 

jannat fizza
by jannat fizza on Sunday, Jun 03 2012 15:54:11 +03:00

anyone here help to make harris point detection   implementation in . NET

New Comment