Skip to main content

Deploying Web Application

Deploying Web Application

In many scenarios copy the web site to proper server location is enough.

In case when we also depend on other 3rd party tools, we want to make registry changes, we want to place some license files on server and certificates etc. Or we are providing a downloadable version of our web application in which case user might have not even framework installed.

Creating Web Application Setup:

Within current Application, Add a Web Setup Project.
File System Editor will open by default.
Right Click Web Application Folder | Add | Select Project Output.
Select “Content Files” and click OK.

Configuring Deployment Properties:
Configuring Launch Conditions:

SELECT View the Select Launch Conditions. Launch Condition editor will open.

Search Target Machine:
          Search for IIS version, File Registry, and windows installer components.
Launch Conditions:
          Based on search condition Launch condition specifies weather to procedd installation or not.

File Search Conditions Properties:
Property
Description
FileName
FileName with extension
Folder
The folder to search for.
Depth
The number of nested of folder to search for.
MinData,MaxDate
Min, max modified date
MinSize, MaxSize

MinVersion, MaxVersion
Min, max version file
Property
Variable name to store search result, that can be used in Launch Condition.

Launch Condition Properties:
Property
Description
Condition
Condition that must be true to continue installation.
InstallUrl
If condition is false, URL from where required component can be downloaded.
Message
Error message when condition is false.

Adding Custom Setup Wizard Pages:
You can add custom wizard pages to gather extra information and Pass them to Custom Actions as a parameter. It allows us to:
* Add a license Agreement
* Modify settings in Web.config
* Perform Custom Configuration (Configuration that are not part of web.config)
* Activate or Register your application

Adding Custom Actions:
Such as, submitting registration information to a web service, validating a product key, or any other work.
There are four stages where a custom action can be added:

Install, Commit, Rollback, Uninstall.

Adding Registry Items:
View | Editor | Regitry.

A condition can be specified for installation of registry key.

String Value, Environment String Value, Binary Value and DWORD Values are supported.

On uninstall Registry key is not removed, to automatically remove it from there set DeleteAtUninstall = true in property window.

Configuring Deployment Conditions:
One can configure the OS version, Service Pack, IISVERSION, Physical Memory.

Windows Installer Property
Description
Version9X
Version number for the Windows operating system. 95, 98, ME
VersionNT
Version number for the Windows NT/Windows 2000, XP, 2003.
ServicePackLevel
The version number of the operating system service pack.
WindowsBuild
Build number of the operating system.
SystemLanguageID
Default language identifier for the system.
MsiNetAssemblySupport
On systems that support common language runtime assemblies, the installer sets the value of this property to the file version of fusion.dll.
ComputerName
Computer name of the current system.
LogonUser
User name for the user currently logged on.
AdminUser
Set on Windows NT/Windows 2000 if the user has administrator privileges.
PhysicalMemory
Size of the installed RAM in megabytes.
Intel
Numeric processor level if running on an Intel processor.
COMPANYNAME
Organization of user performing the installation. Corresponds to the Organization entered in the Customer Information installation dialog box.
USERNAME
User performing the installation. Corresponds to the Name entered in the Customer Information installation dialog box.

To check Environment variables use the following conditions:

%HOMEDRIVE = “C:”

Specifying the installer conditions:

IISVERSION = “#6”
VersionNT = 500

IISVERSION >= “#4”
Version9x <= 450 (ME or earlier)
Not, And, Or Xor, Eqv, and Imp (True if left term is False or Right term is True) are supported.

WindowsBuild = 2600 AND ServicePackLevel = 1

Deploying a Web Application using a Web Setup Project:

Setup.exe: Installs files and settings you added to your Web Setup Project.

WebSetup.msi: Windows Installer file containing any file you added to your Web Setup Project. Behaves exactly the same as Setup.exe. It can be distributed using Active Directory Software Distribution or Microsoft Systems Management Server.

Disadvantage .msi: Target Machine must have Windows Installer installed.

What is Windows Installer?
Windows Installer packages (.msi) are not executables they are opened by Msiexec.exe (Microsoft Installer).

Windows Installer provides the following features to simplify installation.

  1. Transform ( ? )
  2. Properties can be defined on command-line: Some properties that installers use can be overridden by providing their values on command-line.
  3. Standardized Command-Line Options: Specify the variables, switches, files, and paths.

Important Command-Line options:
/I      install
/a      Administrative install
/f       repair
/x      uninstall
/L      Specify path to Log file.
/p      Applies a patch to the specified file
/q      User interface Level (qn: no interface, qb: basic interface)
/? /h Displays Windows Installer version and help info.

Deploying Web Application using the Copy Web Tool:
Instead of self-coping a site from local to live or making changes directly in live site can be dangerous. One can build and then publish changes to the live server using Copy Web Tool or transfer from Staging server to live server.

This coping can be synchronized to publish only those file which have been modified.
To Copy a web site follow the steps:

Web Site | Copy Web Site.
Click Connect and Select destination from the following:
File System, Local IIS, FTP Site, Remote Site (to avoid transfer in clear text, check Connect Using SSL).

To synchronize file(s): Select required file(s) and R.Click and select Synchronize.
To synchronize entire site: Deselect any selected file(s) and R.Click in any Pane and select Synchronize.

Precompiling Web Application:

Allow this precompiled site to be updatable
Specifies that the content of .aspx pages are not compiled into an assembly; instead, the markup is left as-is, allowing you to change HTML and client-side functionality after precompiling the Web site. Selecting this check box is equivalent to adding the -u option to the aspnet_compiler.exe command.

Use fixed naming and single page assemblies
Specifies that batch builds are turned off during precompilation in order to generate assemblies with fixed names. Themes and skin files will continue to be compiled to a single assembly. This option is not available for in-place compilation.

Enable strong naming on precompiled assemblies
Specifies that the generated assemblies are strongly named by using a key file or key container to encode the assemblies and ensure that they have not been tampered with. After you select this check box, you can do the following:

Specify the location of a key file to use to sign the assemblies. If you use a key file, you can select Delay signing, which signs the assembly in two stages: first with the public key file, and then with a private key file that is specified later during a call to the aspnet_compiler.exe command.

Specify the location of a key container from the system's cryptographic service provider (CSP) to use to name the assemblies.

Specify whether to mark the assembly with the AllowPartiallyTrustedCallers property, which allows strongly named assemblies to be called by partially trusted code. Without this declaration, only fully trusted code can use such assemblies.

Popular posts from this blog

Culture Information and Localization in .NET

Namespace: System.Globalization CultureInfo Class:                 It provides information like the Format of numbers and dates, Culture’s Calendar, Culture’s language and sublanguage (if applicable), Country and region of the culture. The Basic use of CultureInfo class is shown here: • How string Comparisons are performed • How Number Comparison & Formats are performed • Date Comparison and Formats. • How resources are retrieved and used. Cultures are grouped into three categories: Invariant Culture : It’s Culture Insensitive. It can be used to build some trial application. It can be also used to build an application with hard-coded expiry date that ignores cultures. But using it for every comparison will be incorrect and inappropriate. Neutral Culture : English(en), Frensh(fr), and Spanish(sp). A neutral culture is related to language but it’s not related to specific regi...

Concept of App Domain in .Net

Creating Application Domains: Application domain is just like process, provides separate memory space, and isolates from other code. But it’s quite light weight. It also provides the following advantages: 1-       Reliability : If a domain crashes, it can be unloaded. Hence doesn’t affect the other assemblies. 2-       Efficiency : Loading all assemblies in one domain can be cumbersome and can make the process heavy but Appdomains are efficient in this manner. Important properties of AppDomain: ApplicationIdentity , ApplicationTrust , BaseDirectory , CurrentDomain , DomainManager , DomainDirectory , Evidence , FriendlyName , ID , RelativeSearchPath , SetupInformation , ShadowCopyFiles . Important methods of AppDomain: ApplyPolicy , CreateCOMInstanceFrom , CreateDomain , CreateInstance (Assembly). To create an AppDomain: AppDomain adomain = AppDomain.CreateDomain(“D”); To execute an assembly:...

ASP.NET Working With Data-Bound Web Server Controls

Suppose we have: List<Car> vCars = new List<Car>(); There are three types of databound controls: Simple databound controls(List, AdRotater), Composite data bound controls(GridView, DetailsView, FormView that inherit from CompositeDataBoundControl), and Hierarchal data bound controls (TreeView, Menu).   DataBoundControl has a DataBind method that can be used when data is ready. It calls DataBind for child controls as well. Page.DataBind() will call DataBind for all child controls. Using DataSource Objects:                                       BaseDataBound control exposes DataSource property that accepts objects that implement IEnumerable , IListSource , IDataSource , or IHierarchalDataSource . DataSourceID accepts ID of SqlDataSource . If both specified Data...