06 April, 2010

Deploy ASP.NET Web Application

After creating and testing your ASP.NET application, the next step is to deploy the application. Deployment is the process of distributing the finished application to be installed on other computer. We can use the built-in deployment feature that comes with Visual studio .NET to create a Windows Installer file - a .msi file for the purpose of deploying applications.

Deploying Applications

To start, open the Web Application project you want to deploy. Say, you have a project named "Deploy" with ten Web pages in it. Select File->Add Project->New Project from the main menu. From the Project Types pane select Setup and Deployment Projects and from the Templates pane select Web Setup Project. Type WebSetup1 for name and specify a location in the location box and click OK. The New project dialogue box looks like the image below.

When you click OK on the above dialogue box, the project is added to the solution explorer window and also a File System Editor window appears as shown in the image below.

The File System Editor window has two panes. Select Web Application Folder in the left pane in this window. From the Action menu (on main menu), select Project Output to open the Add Project Output Group dialog box. It looks like the image below.

Make sure that Deploy is selected in the Project drop-down list and select Primary Output from the list and click OK. You also can select other options depending upon the users of your application.

Now, in the File System Editor window, select Web Application Folder and open it's Properties window. The Properties window for the Web Application Folder looks like the image below.

In this window, set the VirtualDirectory property to any name, say FinishedApp. FinshedApp will be the folder on the target machine where you will install this application. The name you set for this VirtualDirectory property should not already exist on the target machine. If it does, the contents in the folder will be overwritten. Also, set theDefaultDocument property to any page in the application. The page you set in this property will be the default page for the Web Application. Once you are finished with the Properties window build the solution by selecting Build->Build WebSetup1 from the main menu. After the solution is built sucessfully, a WebSetup1.msi file is created in the Debug directory of the Web Setup project. The default path to the debug directory is as follows:
C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\deploy\WebSetup1\Debug.

Installing the Application

You can copy the WebSetup1.msi file to the target machine and double-click to install the Web Application. When you double-click the setup file the dialog that opens looks like the image below.

Click next and you will be taken to the next dialog which looks like the image below.

You can use the default Virtual Directory specified by the installer or you can specify one. Click next to install the application.

No comments:

Post a Comment

Suggestions are invited from readers