Click here to Skip to main content
13,190,405 members (52,256 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


51 bookmarked
Posted 19 Jan 2010

How to deploy ASP.NET Web Application on server

, 19 Jan 2010
Rate this:
Please Sign up or sign in to vote.
Article explaining about diferent ways to deploy ASP.NET web application on server


Hello, in this article i have tried to explain, how a web application is deployed on to web server.

Deployment refers to the process of copying an web application from the development system to the server on which the application will be run. There are several way we can deploy our web application

We can deploy ASP.NET Application in  3 different ways

  • xCopy Deployment
  • Precompiled Deployment 
  • 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.

xCopy Deployment   

To manually copy the files of an web site to a server. We can use the xcopy command from a command prompt. Then we can use IIS’s (Internet Information Serve management console t o create a virtual directory that’s mapped to the directory that you copied the web site to.

It is easier to create a batch file for the xcopy command. Then after we can run that batch file at given time we make changes to the application and want to deploy the updated code.

We can also perform xcopy deployment from visual studio by using copy website command. 

To perform xcopy we use copy web site command. This command lets us to copy website to file system, local IIS, FTP or remote IIS website. At the same time we can copy all or selected files.

How to use this command 

  1. In visual studio open the website to be deployed and choose the website copy web site command.
  2. Then click the connect button to display an open website dialog box that lets to choose the destination to copy the web site to.
  3. Click the arrow buttons to copy the files from the source web site to remote web site.

Publish Web Site 

The publish web site command lets us to precompile an application and copy the precompiled assemblies to a target server. This is the easiest way to use the precompiled deployment feature.

  • Deploys precompiled assemblies to the specific server
  • Lets us to deploy the web site without source code files
  • It is done either from publish web site command or from command prompt using the aspnet_compiler command 
  • Avoids delays caused by compiling web pages when they are first accessed by a user.
  • Finds compile errors before the site is deployed.
  • Can copy just executable files and not the source files to the server.

The build -> publish web site command compiles all of the files makes up an application, and then deploys the compiled assemblies to the location we specify.

Publish Web Site

If we check allow precompiled site to be updatable box, the source files are deployed along with the executable files. If we uncheck then source code files aren’t deployed.

The syntax of aspnet_compiler command
The aspnet_compiler command is located in the framework directory,

aspnet_compiler –v virtual-directory [-u] [-d] [-f] [target-directory]


  • -v name of virtual directory of existing web site
  • -u precompiled website will be updated
  • -d debug information is included in compiled assemblies
  • -f overwrite target directory if exist

Precomplies existing website
Aspnet_compiler –v test d:\test

In same place
Aspnet_complier –v test

With debugging information
Aspnet_compiler –v test –u –d d:\test

If we specify target directory the precompiled web site is stored in the specified directory else the website is precompiled in place

Setup Deployment

  • It uses a web setup project to build a windows setup program used to deploy website onto server.
  • Useful for deployment on multiple servers.
  • Can be used to deploy precompiled assemblies and can be configured to include or omit the source code.
  • The installed application can be removed by using add or remove programs dialog box from control panel

How to create a setup
Choose the file -> add -> new project command to display the add new project dialog box. Then, choose setup and deployment. Select web setup project as template, enter a name for websetup project click ok.

Add project to Out put Group  

In the solution explorer right click the web setup project and choose the add-> project output command to display the add project output group dialog box, then click ok to add the content files from you website to the web setup project

Use the buttons that are displayed at the top of the solution explorer when web setup project is selected to access setup editors that lets us to customize various aspects of the web setup project.

Add setup prerequisites 


Visual studio creates files named setup.exe and setup.msi. setup.exe is the file we will run to install the application and setup.msi contains all of the files to be installed.

The setup.exe and setup.msi files are stored in the web setup project’s debug or release folder.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Indrajeet Sutar
Software Developer (Junior) Excel Informatics, Pune
India India
Am Indrajeet T. Sutar. I am a web developer. I am working on .net technology. I have completed my Masters in Computers and Management (people call it as MCA, MBA etc.) Apart from programming i do photography (not regularly though), traveling and reading books.

You may also be interested in...


Comments and Discussions

Questiondeploy and install c# project in web server Pin
Member 1075135724-Dec-14 6:27
memberMember 1075135724-Dec-14 6:27 
Question[My vote of 1] meh Pin
jamagboo14-Apr-14 23:16
memberjamagboo14-Apr-14 23:16 
GeneralThis is exactly what I needed Pin
Member 985690918-Feb-14 8:57
memberMember 985690918-Feb-14 8:57 
QuestionThe setup.exe and setup.msi files are stored in the web setup project’s debug or release folder. Pin
Harisul Islam23-Nov-13 16:08
memberHarisul Islam23-Nov-13 16:08 
GeneralMy vote of 1 Pin
Reza Oruji21-Aug-13 0:03
memberReza Oruji21-Aug-13 0:03 
GeneralMy vote of 1 Pin
umamahesh20207-Aug-13 19:40
memberumamahesh20207-Aug-13 19:40 
QuestionASP. Net Hosting Problem Pin
The Kaushik Basu25-Feb-13 15:27
memberThe Kaushik Basu25-Feb-13 15:27 
GeneralMy vote of 1 Pin
Goutamkumar73-Jan-13 23:35
memberGoutamkumar73-Jan-13 23:35 sit deployment with sql server database Pin
joinsst29-Nov-12 1:37
memberjoinsst29-Nov-12 1:37 
GeneralMy vote of 5 Pin
joinsst29-Nov-12 1:35
memberjoinsst29-Nov-12 1:35 
QuestionWeb setup projects are not supported in VS 2012. Pin
Michael Freidgeim20-Sep-12 2:11
memberMichael Freidgeim20-Sep-12 2:11 
QuestionProblem in installing the web set up Pin
su_ma201026-Jan-12 19:10
membersu_ma201026-Jan-12 19:10 
GeneralMy vote of 3 Pin
chirag.khatsuriya2-Dec-11 21:40
memberchirag.khatsuriya2-Dec-11 21:40 
GeneralMy vote of 4 Pin
Narendra G. mane.28-Oct-11 21:11
memberNarendra G. mane.28-Oct-11 21:11 
GeneralMy vote of 4 Pin
jitendra prajapat4-Oct-11 2:40
memberjitendra prajapat4-Oct-11 2:40 
Generalthanks Pin
BSRK24-Mar-11 20:14
memberBSRK24-Mar-11 20:14 
GeneralMy vote of 1 Pin
chenameni27-Sep-10 22:59
memberchenameni27-Sep-10 22:59 
QuestionWhy not use a deployment tool to help manage the application maintenance? Pin
Daniel Kushner20-Jan-10 17:56
memberDaniel Kushner20-Jan-10 17:56 
GeneralMy vote of 1 Pin
g0got219-Jan-10 20:01
memberg0got219-Jan-10 20:01 
GeneralRe: My vote of 1 Pin
sachinthamke31-Jan-11 2:11
membersachinthamke31-Jan-11 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171016.2 | Last Updated 19 Jan 2010
Article Copyright 2010 by Indrajeet Sutar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid