How to install IIS website specified by the user

ImportantThe following article uses options that are available starting with the Enterprise edition and project type.

This tutorial will present a quick way on how to author an installation package in order to install a website. When running the installation package you will be presented with the possibility to either select an existing website or create a new one.

In order to install a new website or select an existing one for installation the following steps must be taken:

1. In the Install Parameters Page define the property MY_WEBSITE and set the value to <none>.

2. Add the website files to the project by using the Files and Folders Page.

3. Create a new dialog called BrowseIIS after WelcomeDlg in the "Dialogs Page.

4. In the BrowseIIS dialog add a combobox and set its property name to IISBrowseComboBox.

5. In the IIS page create a new website and name it [MY_WEBSITE]. Under this website create the virtual directories or web applications.

6. Add a new Browse Web Sites operation from the IIS toolbar and follow the instructions from the Browse for IIS Web Sites & Virtual Directories article to configure it.

Caution!Although the operation of enumerating Web Sites and Virtual Directories on the IIS server does not alter its configuration, for security reasons, the system does not allow accessing any IIS configuration properties without administrator privileges. Due to this security policy, the installing user must be a member of the Administrators group and, on Windows Vista or above, an UAC Elevation will be necessary in order to proceed.

7. In the Data Output section of the browse add a Web Site Name/Virtual Directory entry associated with MY_WEBSITE property.

8. In the Execution section select “Attached to an event” option and then point to the BrowseIISInitializer event for the BrowseIIS dialog.

TipDuring the installation in the created dialog you can either write in the combobox the name of the website you want to install or select an existing one.

Running the installation package

When running the installation package the user can choose between three possible cases:

  1. In the combobox from the BrowseIIS dialog select the Default Web Site. In this case only the virtual directories and web applications will install.
  2. In the combobox from the BrowseIIS dialog select an already existing web site. In this case only the virtual directories and web applications will install.
  3. In the combobox from the BrowseIIS dialog write the name of the desired web site. In this case the website will be created on the target machine along with its virtual directories and web applications.

NoteYou can download a sample project from here (Enterprise or Architect Edition is needed).