Agafonov Slava Digest about software

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

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

Comments (11) -

  • Gunnar Peipman

    11/3/2010 7:29:10 PM | Reply

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

  • Agafonov Slava

    11/4/2010 4:02:09 PM | Reply

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

  • Gunnar Peipman

    11/23/2010 1:03:52 AM | Reply

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

  • Agafonov Slava

    12/3/2010 11:41:26 AM | Reply

    Do you know something about razor deploy routing?

  • Tugberk Ugurlu

    2/19/2011 4:49:24 PM | Reply

    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.

  • sleep apnea mouth guard

    5/5/2011 9:36:39 PM | Reply

    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.

Add comment

Loading

Copyright © 2018 - Design by FS