Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Deploy IIS Site Script Template

view on GitHub

The Deploy IIS Site Script Template is a is a simple, no-code solution for deploying your application to an IIS Site, Application, or Virtual Directory.

Or, if you don't have these IIS components already configured, this script template can optionally create them. It can also update existing settings during deployment.

The Deploy IIS Site script template will:

  1. Stop Application Pool to allow for the artifact to be deployed
  2. Deploy Artifact, which will synchronize the contents of the artifacts file and target directory by performing an incremental transfer
  3. Deploy Azure Web App, which will deploy a specified web
  4. optionally Make IIS Changes
  5. optionally Deploy an application configuration file, which can be either a built-in configuration file or a configuration transform
  6. Start Application Pool again.

This article will detail the deployment processes available, the scripts for each, and how they are performed.

Using this Script Template

To add this script template to your application, navigate to Scripts, click "Add Script", and then select "Deploy IIS Site" from the list of Deploy Script Templates. After doing so, you'll see a dialog like this:

Create Script Template

This article will discuss how these options work in the deployment process.

Stop Application Pool

First, the script template will stop the specified application pool, and waits for the application pool to be stopped. If the application does not exist, then a warning will be issued.

Configure IIS

Depending on your deployment process (see Microsoft's IIS Architecture), you will have several IIS options available to you, selected from the "IIS Options" box.

Site Options

Change/Update IIS Site Options

This option will be made available when selecting "Change/Update IIS Site Options" from the "IIS Options" box.

Site Bindings

On the "Site Options" tab, there are two fields you can set:

  • Site Name refers to the name given to the website you are deploying in IIS. This name is not used in the URL that users will access and is primarily a human-readable label for organizational purposes.
  • URL Binding are configurations that determine how your website will respond to incoming requests based on the URL that the client uses to access the site, checked by IIS to determine which site should handle the request. You can have multiple bindings.

To add a URL binding you will be required to enter:

  • Protocol (e.g. HTTP)
  • IP Address (e.g. 192.168.1.100)
  • Host (e.g. www.example.com)
  • Port (e.g. 80)

If you select HTTPS as your protocol, you will be required to enter additional information:

  • Lookup Certificate By (Friendly Name or Thumbprint)
  • Friendly Name/Thumbprint (e.g. ExampleCertificate2023)
  • Certificate Store Location (LocalMachine or CurrentUser)
  • Certificate Store (e.g. Personal)
  • Options: Require SNI (Strong Name Indication)

Change/Update IIS Application Options

This option will be made available when selecting "Change/Update IIS Application Options" from the "IIS Options" box.

Application Options

On the "Applications Options" tab, there are two fields you can set:

  • Site Name refers to the main website or web application that is already hosted and running in IIS.
  • Alias also known as the "Application Alias," is the name given to the application within the main website. It represents the virtual path where the application resides within the site.

Change/Update IIS Virtual Directory Options

This option will be made available when selecting "Change/Update IIS Virtual Directory Options" from the "IIS Options" box.

Virtual Directory Options

On the "Virtual Directory Options" tab, there are two fields you can set:

  • Site Name refers to the main website or web application that is already hosted and running in IIS.
  • Alias also known as the "Virtual Directory Alias" or simply "Virtual Directory," is the name given to the virtual directory within the main website. It acts as a virtual path or link to a different physical folder on the server's file system.

Change/Update Application Pool

When changing or updating IIS Sites or IIS Applications you also have the option of creating or updating an application pool. Checking this box will enable the "App Pool Options" tab, with four fields you can set:

Application Pool

  • .NET CLR version specifies which version of the .NET Common Language Runtime (CLR) the application pool will use to run managed code.
  • Enable 32-bit applications will need to be enabled if your server is running a 64-bit version of Windows and you need to run a 32-bit web application. By default, IIS runs application pools in 64-bit mode, which means they can't load 32-bit assemblies.
  • Managed pipeline mode defines how IIS handles requests and passes them to managed code. For new applications, it's generally recommended to use the "Integrated" pipeline mode.
  • Identity defines the security context (user account) under which the application pool's worker processes (w3wp.exe) will execute. It determines the permissions that the worker processes have on the server and the resources they can access.

Selecting the appropriate identity is important when balancing security and functionality, and depends on the specific requirements of your web applications. If you need more information, see the IIS Documentation.

Deploying Artifact

Then, the script template will deploy an artifact to the specified path, such as C:\Apps\MyApp or /var/Apps/MyApp. To reduce deployment time, an incremental deployment approach will copy only the files that changed. A file is considered to be changed if the file size or last-modified-on date is different. To learn more, see Build Artifacts for more details.

Additional Artifact Options

On the "Artifact options" tab, there are two fields you can set:

  • Artifact name is the name of the artifacts file attached to your build; the default name for this file is Default, but you may have named it something different when creating it
  • Transfer all files will not use the incremental deployment method, and instead transfer all files; this may be helpful if your file has thousands of small files, and it's simply quicker to deploy them all instead of compare them

Deploying Config Files

If you selected an option for the "Configuration file" field, the script template will deploy or transform a configuration file.

Deploy BuildMaster Configuration File

If "Deploy BuildMaster Configuration File" is selected, you must have first created a configuration file in your BuildMaster application. You may select this configuration file from the Config File Options tab to include it as part of your deployment.

Transform Config File

If "Transform config file" is selected, the script template will use the Microsoft web.config transformation process to create a configuration file from a "base config file" and a "transform config file". Both the base and transform config files should be included in the artifact that was already deployed.

This feature can be used for any files that follow Microsoft's transformation format, even those that are not web.config files.

Start Application Pool

Finally, the script template starts the specified application pool.