in4mation ... organized

How to Deploy an ASP .NET 2.0 Web Application using Installers

Article Written by Shanaz Bin Mohamed Abdul Lathiff and Pramod S Nair for www.wisdombay.com

This article is a hands-on approach on deploying an ASP .NET 2.0 Web Application using Installers. It will help you in creating Installer files which can be used for deploying your locally built Web Application on a remote server. The method of using Installers for deployment is very much easy as all that is needed to be done on a server to get the Web Application hosted is to execute the installer and follow a simple Wizard Interface.

What is ASP .NET and what the heck is an ubiquitous 2.0 doing with it.

So as a starting point let's get some basics right! If you are already familiar about what ASP .NET stands for (hmm. and about the ubiquitous 2.0 then skip this introduction).

Before telling what ASP .NET is we have to understand what kind of website is usually referred to as a dynamic website.

Literally, websites which have their pages dynamically created as per the requests placed on the web server are called dynamic web sites and Web pages in those websites whose content is produced or generated dynamically based on user input or other information are called dynamic web pages. Examples for such websites are search engines, discussion forums etc where the output page is generally produced by the web server on the fly as per the requests.

So how does the web server serves dynamic WebPages as per requests ?

That is where the magic of Server Scripting languages comes in. These scripting engines sits behind the web server and as per the developer has instructed them to react, they generates HTML code as per the demands in the requests from clients passed on to them by the web server. They usually pulls contents from some data storages like files or database servers according to the conditions specified in the requests and spins off HTML code which is then served back to the client by the web server.

There is a lot of Web scripting technologies that the developer can make use of and ASP .NET is one of them. Yes, so now you come to know that ASP .NET is nothing but a scripting engine, which is sitting on a web server ready to serve the web server with dynamically generated content, which in turn is utilized by the web server as responses to client machines. It is the web server which decides whether a request needs the service of the Scripting Engine or not. It usually decides this by looking at the extension of the requested files and ASP .NET files usually have an extension of .aspx.

How a webserver with ASP .NET serves a dynamic webpage
How a request for a dynamic page is handled by a Web server running ASP .NET

Nome something very important :-), hey what is that 2.0. The number that comes after the word ASP .NET stands for the version of the ASP .NET technology that is hosted on the web server and ASP .NET 2.0 means that you are dealing with a very powerful and very latest avatar of ASP .NET from Microsoft.

Now having made the introductions, let's move on to more slippery grounds and find out how to deploy an ASP .NET application on a server with the help of Installers.

So tell me about deployment

Deployment means the process of publishing your finished web application on a web server for the purpose of serving the Application to the wide world out there. The simplest way of deployment is setting up the required virtual directory or website on the IIS and using the 'xcopy' command or Windows Explorer to copy the files to the virtual directory that you created on the server. Or you can use the 'Copy Web Site Wizard' and 'Publish Web Site Wizard' provided in the Visual Studio 2005 for copying your finished Web App to the server.

Another option that is available is using the 'Web Setup Project' option that is included as a Visual Studio Template project. The output produced by the Web Setup Project is a Windows Installer set of files that can be run on a target server to set up the website. This type of deployment enables users to see the installed package on the Add/Remove program list on the target server after the install is complete. From the Add/Remove program list, the user can easily remove the component to uninstall the website from the target server.

It is this last method that we are having a look in this article.

So Let's Do It

1. To start deploying using this method, first we have to take new project from Microsoft Visual Studio 2005 from the menu. Then choose Web Setup Project from Other project Types - Setup and Deployment as in the following figure.

Starting a new Web Setup Project
Starting a new Web Setup Project

2. The Web Setup project will show you an interface containing a view of the file system as to be on the target machine.

a view of the file system as to be on the target machine.
A view of the file system as to be on the target machine.

3. By right clicking the Web Application Folder, we can add a new web folder, project output details, and file and assembly information. After adding the necessary folders and files as in the same order in the web project we can build the application.

The view after adding the required files and folders contained in the web Application
The view after adding the required files and folders contained in the Web Application

4. We can select the property window in web setup project window to give more details for the project like manufacture details, product code, product name, version etc.

The Property Sheet
The Property Sheet of the Web Setup Project

5. Now build the project and the web setup project will create a msi setup and a windows installer package setup in the debug folder of the web setup project. Now these installer files can be used to deploy our web application on the target server.

That is it, Web Application installers can be created for deployment purposes as explained above. So go ahead and create an installer for your next big web application.