Setup Project Deployment of an ASP.NET Web Forms Application
- 5 minutes to read
In this lesson, you will learn how to deploy an ASP.NET Web Forms XAF application using the Setup Project method. You will create a simple installer for the application. This method should only be used if you have either local or remote desktop administrative access to the Web Server. If you are deploying an ASP.NET Web Forms application to remote web hosting, choose an alternative deployment method (Xcopy Deployment of a Windows Forms Application or Publish Wizard Deployment of a Windows Forms Application).
Perform the following steps at the Developer Workstation.
Right-click the Solution item in the Solution Explorer. Choose Add | New Project… in the context menu. In the invoked Add New Project dialog window, locate the Other Project Types | Setup and Deployment node in the Project types section. In the Templates section, select Web Setup Project. Enter the required Setup project name. For instance, call it MySolution.Web.Setup. Click OK.
Specify the Setup project properties via the Properties window. Set the Author property to your name. Set the Manufacturer to your company name. Set the ProductName to MySolution Web. Set the RemovePreviousVersions to True. Set the Title to MySolution Web Setup.
Right-click the MySolution.Web.Setup project in the Solution Explorer. In the invoked context menu, choose View | File System.
Right-click the Web Application Folder node in the File System tree. Choose Add | Project Output…
In the Add Project Output window, set Project to MySolution.Web, Configuration to Release Any CPU, select Content Files and click OK.
In the File System tree, right-click the Web Application Folder | bin node. Choose Add | Project Output…
In the Add Project Output window, set Project to MySolution.Web, Configuration to Release Any CPU, select Primary output and click OK.
Check that the Web Application Folder contains the Content Files item. Check that the bin subfolder contains assemblies referenced by the application.
In the Web Application Folder Properties window, set the VirtualDirectory to “mysolution”. It will be used by the installer as the default virtual directory name.
If your application is localized and uses the pre-built satellite assemblies, the satellite assemblies should be deployed with the application. So right-click the Web Application Folder | bin item in the File System pane and choose Add | Folder. Set the name of the new folder to the language culture code (for instance, “de” for the German language). Add the required satellite assemblies to this folder (right-click the folder and choose Add | File…).
Additionally, the satellite assemblies with your custom localizations made within modules, should be added. Right-click the Web Application Folder | bin item in the File System pane and choose Add | Project Output…. The Add Project Output Group dialog will be invoked. In the Project dropdown list, select the module project (e.g. MySolution.Module). In the output type list, choose “Localized resources”. In the Configuration drop-down list, select the Release configuration. Click OK. All the dependent assemblies will be added to the Setup project. Analogously, add the required localized resources from the platform-specific module.
Build the MySolution.Web.Setup project.
- After a successful build, check that the setup.exe and MySolution.Web.Setup.msi files exist in the MySolution\MySolution.Win.Setup\Release folder. Copy these files to a location accessible from the Web Server.
Perform the following steps on the Web Server. Either login to the Web Server locally or via a remote desktop.
Launch the setup.exe file. In the invoked Open File - Security Warning dialog, click Run.
In the invoked MySolution Web Setup Wizard dialog, click Next.
Specify the virtual directory name. For instance, you can set mysolution as the virtual directory name. In this instance, the ASP.NET Web Forms application will be accessible via http://servername/mysolution URL.
In the invoked confirmation dialog, click Next.
Wait until the installation process finishes.
Run the IIS Manager and check that the ASP.NET Web Forms application web folder exists and contains application files.
Open a web browser and type “http://localhost/mysolution“ in its address bar. Most probably, the Web Server will display an error message stating that an assembly is missing.
The reason for this error is that when building the application, the reported assembly was not copied to the MySolution.Web\Bin folder from the Developer Workstation Global Assembly Cache (GAC). To resolve this error, copy the required assembly to the Bin folder on the Web Server. There is the following location on the Developer Workstation where you can get the required assembly: %PROGRAMFILES(x86)%\DevExpress 21.2\Components\Bin\Framework.
You can register the required assembly in the GAC, instead of copying it to the application folder. Navigate to the c:\Windows\assembly folder in Windows Explorer and drop the assembly file into it. The assembly will be registered in GAC.
Refresh the web page and see if there are other missing assemblies. Copy it from the Developer Workstation. Repeat the process until there are no errors reported on missing assemblies.
Only run-time assemblies from the Developer Workstation are required. Ensure that you do not accidentally copy design-time assemblies or XML files which are named like the run-time assemblies.
If the application displays the following message, it requires a proper connection string in its configuration file, and access to its database. The Set Up the Database Connection lesson describes how to resolve this issue.
You have the capability to uninstall your ASP.NET Web Forms application via Programs and Features (Add or Remove Programs) Control Panel applet.
Now your application needs a connection to a database to run properly. Proceed to the Set Up the Database Connection lesson to learn how to do it. To familiarize yourself with alternative deployment methods, refer to one of the following lessons.
- Xcopy Deployment of an ASP.NET Web Forms Application
- Publish Web Deployment of an ASP.NET Web Forms Application