Nov
2
2010

Deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed

Deploying ASP.NET MVC 3 web site

You can built sample application on ASP.NET MVC 3 for deploying it to your hosting first. To try it out first put it to web server where ASP.NET MVC 3 installed. In this posting I will tell you what files you need and where you can find them. Here are the files you need to upload to get application running on server where ASP.NET MVC 3 is not installed.

Deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed

Also you can deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed like this example: you can change reference to System.Web.Helpers.dll to be the local one so it is copied to bin folder of your application. First file in this list is my web application dll and you don’t need it to get ASP.NET MVC 3 running. All other files are located at the following folder:

C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\

If there are more files needed in some other scenarios then please leave me a comment here. And… don’t forget to convert the folder in IIS to application. While developing an application locally, this isn’t a problem. But when you are ready to deploy your application to a hosting provider, this might well be a problem if the hoster does not have the ASP.NET MVC assemblies installed in the GAC. Fortunately, ASP.NET MVC is still bin-deployable. If your hosting provider has ASP.NET 3.5 SP1 installed, then you’ll only need to include the MVC DLL. If your hosting provider is still on ASP.NET 3.5, then you’ll need to deploy all three. It turns out that it’s really easy to do so. Also, ASP.NET MVC runs in Medium Trust, so it should work with most hosting providers’ Medium Trust policies. It’s always possible that a hosting provider customizes their Medium Trust policy to be draconian. Deployment is easy when you know what to copy in archive for publishing your web site on ASP.NET MVC 3 or later versions.

What I like to do is use the Publish feature of Visual Studio to publish to a local directory and then upload the files to my hosting provider. If your hosting provider supports FTP, you can often skip this intermediate step and publish directly to the FTP site. The first thing I do in preparation is to go to my MVC web application project and expand the References node in the project tree. Select the aforementioned three assemblies and in the Properties dialog, set Copy Local to True.

Deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed 

Now just right click on your application and select Publish.

 publish-project_3

This brings up the following Publish wizard.

Publish-Web

Notice that in this example, I selected a local directory. When I hit Publish, all the files needed to deploy my app are available in the directory I chose, including the assemblies that were in the GAC.

References

ASP.NET MVC 3 with Razor example

Cool ASP.NET blog of Gunnar Peipman

Changes in ASP.NET MVC 3 Beta

JavaScript and ASP.NET MVC Framework Features

Summary

We can deploy ASP.NET Application (ASP.NET MVC 3 web application) in 3 different ways: 1) xCopy Deployment 2) Precompiled Deployment 3) Web Setup Project.

The choice of best deployment alternative depends upon particular need of each application. Xcopy deployment is the most easiest, and it is often used during development to create copies of an application n different servers for testing purpose. For small application xcopy deployment may be the best choice. Precompiled deployment has several advantages over XCopy deployment. Eg. Precompiled deployment is always gives better performance for the first users of the site at the same time it is more secure as we don’t need to copy our source code files on to server. If our application deployed on one or few servers then precompiled deployment is usually best choice.

When we are going to deploy our application on number of servers then creating a setup program is a very handy tool. Although creating this setup program is much tedious and involves considerable working, the deployment from this setup program becomes very easier. Notice that it says that “assembly is required by one or more applications”. In general, there shouldn’t be any difference between running your application with MVC gac’d and it ungac’d.

Deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed

DotNetShoutout
DotnetKicks

This blog content RSS subscrption.

Comments (12) -

Gunnar Peipman

If you use materials from other blogs then please add also reference to these blogs.Smile

Agafonov Slava

Sure Gunnar, I used some info from your cool ASP.NET blog and I put some reference to you.

Gunnar Peipman

Thanks! Smile And keep up good blogging - you have very good blog!

Agafonov Slava

Also check this article: www.hanselman.com/.../...rWithoutMVCInstalled.aspx

Scott is answering your questions about BIN Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC installed.

Agafonov Slava

Do you know something about razor deploy routing?

Tugberk

For MVC 3 RC 2 Deployment, there needs to be some extra files to be deployed. Please check http://www.tugberkugurlu.com/39

Viacheslav Agafonov

Tugberk, thnaks for sharing,you have good article.

party bets

Hi,

Very nice post, congratulation.

Thanks you for all.

Tugberk Ugurlu

You're welcome. but what you did here whcih is set the copy local property to true is very clever and time saver. thank's for bringing that up.

Tugberk Ugurlu

Viacheslav,

as you know this method is not enough for some cases. I have published a blog post regarding the IIS configuration for ASP.NET MVC. Please refer : http://www.tugberkugurlu.com/47

sleep apnea mouth guard

Sometimes it is very complicated for us to be installing ASP.NET MVC. Some are requiring a lot of things that makes it hustle to work on. But with this easy steps it has been made and given for all to follow and work on.

tugberk

believe it or not it's now easier :

check this out

iwantmymvc.com/2011-03-23-bin-deploy-aspnet-mvc-3-visual-studio

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Author - Agafonov Viacheslav

Agafonov Slava site

Hello world! My name is Agafonov Viacheslav. I'm a software engineer at Microsoft located in Bellevue next to Redmond campus and Seattle downtown, state Washington. I was born in Ukraine. My passion for programming is in my ability to create tools that make people's lives easier.

Vyacheslav Agafonov profileAgafonov blog Agafonov Slava on Twitter Counter.com

Month List

Disclaimer

The opinions and information that expressed here do not represent my employer's view in any way. Information in this blog is my own opinion and does not reflect on employer. Content on this site is licensed under a Creative Commons 3.0 license.

Advertise with me!