You are on page 1of 8

oducts

ch Control How to Deploy ASP.NET Web Application


ghlighter
cut Controls
pt Package
ervices
dable Web Hosting
Introduction
Project Search
Programming Several times we encounter a grea
tes Master List sophisticated web or desktop applic
rticles that does not poses it's appropriate
SP.NET market share just for the reason of
indows Forms poorly written SETUP package and
NET Framework
designed deployment strategy. The
nce Tutorials
b Domains is simple: If your users are not able
g Credit Cards easily deploy your application then
nti Spam whatever sophistication or features
ey with Web Site provide, they will be unable to even
Home experience your application from th
Shop very first place!
dvertise
Affiliate
In this tutorial we are going to show
Contact
a set of techniques by which you ca
package and deploy your web applications .....

Alternatives

When it comes to web applications specifically, then you will encounter many techniques that ca
utilized as a deployment strategy for your web application:

XCOPY Deployment

The most trivial technique is to simply copy your web application files to the production server
drive and set a virtual directory there. The setting of a virtual directory is needed by several
deployment schemes and can be achieved from Internet Information Manager Microsoft Manag
Consol (MMC snap-in). Because developers typically use the command line order 'XCOPY' to
implement this technique, this technique is typically referred to as XCOPY Deployment.

Copy Web Site

Copy Web Site is a new technique provided in ASP.NET 2.0 and Microsoft Visual Studio 2005
(Available from the Website / Copy Web Site... Menu option). Although this technique is perform
from inside Visual Studio (in contrast with the XCOPY deployment technique which is performed
outside Visual Studio), there is no compilation performed at all. All your pages are still in their s
code form on the production server. Some developers see this fact as a high risk on their intelle
property. Two extra disadvantages of this technique (and in fact any other technique that does
involve any compilation before deployment) are reduced error checking and the slow initial pag
load.

The reduced error checking is a direct result to that no compilation is performed and hence som
errors may be discovered by your users later. The initial page load slowness is also because not
is compiled yet and the entire web application has to be compiled at the time the first page is b
requested. An advantage of this technique over the XCOPY deployment is that you have the op
to deploy to the File System, the Local IIS, the FTP Sites, and the Remote Sites. Please see figu

Figure 1
Pre-compilation

All of the deployment methods we mentioned so far suffer from the fact of that no compilation
performed along with the disadvantages that comes as a direct result from this fact. To ensure
page load and some protection of your source code, you should pre-compile your web site befo
deployment.

Pre-compilation can be performed in-place by just adding '/Deployment/Precompile.axd' to the


URL of your web application and opening the resulting URL in Internet Explore.

Pre-compilation can also be achieved using the command line compiler 'aspnet_compiler'.

Using Microsoft Visual Studio 2005 you can still perform pre-compilation from the 'Build / Publis
Web Site' menu command. Please see figure 2.

Figure 2
SETUP Projects

It's always desirable to package your web applications such that they are easy to deploy on the
production server. Microsoft Visual Studio 2005 gives you this rich packaging option for free ...
follow the following instructions ...

First of all you need to know that our target is to create a package (and MSI file) that contain o
web application in a form that can be later easily deployed on the final production server.

Let's start by selecting 'File / New / Project' in Microsoft Visual Studio 2005. This will present yo
famous set of possible project types from which you will select 'Other Project Types / Setup and
Deployment' then you will select the 'Web Setup Project' icon from the side to the right. See fig
3.
Figure 3
In figure 3, set the appropriate project name and folder options then click OK.

You can always have the same behavior by adding the SETUP project above to your web applica
solution instead of creating a new separate solution. You can achieve this by selecting 'File / Ad
New Project' instead of 'File / New / Project'. This way you will have a self contained web solutio
The 'File / Add / New Project' method is much more recommended.

Your setup project will then open as in figure 4 below:


Figure 4
You will then need to add your web application files to the SETUP project we are developing now
This can be achieved by right clicking your SETUP project name in solution explorer and selectin
'Add / Project Output'. Please see figure 5.

Figure 5
To tune the properties of our SETUP project, we will need to press F4 while it's name is selected
the solution explore. This will bring the SETUP project's properties window. Several useful prope
can be set in this window:

Property Purpose
Author, Description,
Manufacturer,
Use all of these properties to identify / descr
ManufacturerUrl,
your application and yourself.
ProductName, Subject,
Title, and Version
Here you can specify the icon to be displayed be
AddRemoveProgramsIcon your application in Windows Control Panel's Add R
Programs.
Specify here whether or not a check is to be perf
DetectNewerInstalledVersion to determine the existence of a new version alre
installed of your web application.
Specify here whether you need an older version of
RemovePreviousVersions web application to be removed if a newer version
being installed.
Some web applications requires the Internet
Information Service to be stopped and then resta
RestartWWWService
after the deployment of the application. Use th
property to control such behavior.
The last and most important step is to actually build our SETUP project. This cane be achieved
right clicking the name of our SETUP project in the solution explorer. It's this specific step that
creates the MSI package / file mentioned above. This is the file you will need to distribute to yo
users and this is the file they will use to deploy the web application on their production server.

It's worth mentioning that the actual deployment process will be some what similar to the SETU
any typical desktop application (with some exceptions of course). One of the many similarities i
the web application after deployment will automatically appear in the 'Add / Remove Programs'
window of Windows Control Panel.

Production Server Deployment

For your users to deploy your web application they will just need to double click the MSI file. Th
produce something similar to figure 6:
Figure 6
For further information

Refer to the online copy of Microsoft Developers Network at http://msdn.microsoft.com or use y


own local copy of MSDN.

Related articles:
1. Validating User Input In ASP.NET 2.0 Web Applications
2. Dynamic User Interface in ASP.NET Web Applications
3. Multithreading in ASP.NET
4. Build Notepad ASP.NET Web Application - part 2 of 2
5. Build Notepad ASP.NET Web Application
6. .NET Framework Assemblies
7. Introduction to Visual Web Developer 2005 - Express Edition
8. Classic ASP vs. ASP.NET
9. How To Deploy .NET Windows Application

Tutorial toolbar: Tell A Friend | Add to favorites | Feedback

Copyright © 2002-2008 Bean Software. All rights reserved.

You might also like