1. What We Do
  2. Case Studies
  3. Products & Partners
  4. News
  5. About Us
  6. Contact Us

Automatically Deploying IIS Express with your Web-based Software

Automatically Deploying IIS Express with your Web-based Software

Why IIS Express?

While many businesses use Microsoft’s IIS to host their websites, a Microsoft Server operating system with a full Internet Information Services (IIS) suite is not always necessary, and sometimes too complicated for the average user to configure.

If your business needs nothing more than a straightforward website hosted, then the full IIS suite can be a bit of overkill. A large portion of IIS functionality that you pay for might go unused. Also, having to wade through so many settings to find the right one can be confusing and dangerous, even for experienced users.

Microsoft provides a free alternative – IIS Express – which provides the user with basic web hosting capabilities. If you would like to host a few simple websites running on the .NET framework, IIS Express is the perfect solution.
IIS Express 8.0 is the relatively new, lightweight and free brother to IIS. We would recommend using it if:

Benefits of IIS Express

• You don’t want to pay for a Server package with IIS

• Your software needs to deploy in an environment that doesn’t necessarily have IIS installed, and you don’t want the users to have to install a web server themselves

• You don’t need all the features of IIS

• You need Microsoft support for your product
In our case, we are not the end users of our web-based software.

Context: Deploying IIS express as part of an installation

Our software package, Stadium 5, enables users to rapidly develop and host their own interactive websites.

Stadium 5 requires a web server for users to deploy applications they create. Previous versions of Stadium 5 assumed the user had IIS installed and configured. We needed to remove the dependency, and therefore install IIS Express if the user didn’t have IIS installed. Not all users would be installing on Microsoft Server 2012 or similar operating systems. Similarly, not all users would have IIS installed on their operating systems – so we needed to install IIS Express automatically, should the user not have IIS.

The automatic installation of IIS express would lessen the learning curve of our product, and simplify installation to a single page. Additionally, Stadium 5 would serve as a layer between the user and IIS express, so the user would not need to do any complicated modification of the IIS express configuration.

However, automating the installation and configuration of IIS Express is not as easy as it could be. Since it is still a fairly new product, we encountered quite a few problems and errors while trying to install it automatically.

The process is explained in detail below.
IIS Express is not entirely intuitive. It is quite different to IIS, and does not come with a Graphical User Interface (GUI) like IIS, but rather relies purely on .config file manipulation.

Overall IIS structure and functionality

This isn’t necessarily a bad thing, especially for automation purposes.

• The installation path is defaulted to your Program Files folder.

• As each user runs the iisexpress.exe process, located in the installation path, IIS Express creates a home directory for that user in their Documents folder. Configuration files for that instance of IIS Express are stored in that folder.

• The iisexpress.exe process runs as the NT AUTHORITY\SYSTEM user. Should you access databases from your web application, it will use that user to access the database.

• Each user’s applicationHost.config file in his home directory stores that user’s web application information in XML format. As a result, each user will have his own web application list.

In some cases, such as ours, it is not desirable to have different instances of IIS Express for different users. Unfortunately, it’s not very simple to run one instance of IIS Express between multiple users:
We used the WIX Toolset to build our installer file. The installer downloads and installs IIS Express if no IIS is installed. This functionality could easily be replicated with other install kits.
When you run iisexpress.exe from the command line, you can specify the flag /userhome:[home], where [home] can point to any directory. Using this means, you can have a central IIS Express configuration file in a location such as your C:\Users\Public\Documents folder. Beware of choosing a folder that some users don’t have access to.

Automatically installing IIS Express

We used the WIX Toolset to build our installer file. The installer downloads and installs IIS Express if no IIS is installed. This functionality could easily be replicated with other install kits.

Automatically installing IIS Express
Automatically installing IIS Express

Running IIS Express between multiple users

The first time this command is run, the configuration files will be created in the userhome directory if they do not yet exist.

However, when setting a common userhome, we encountered a problem with using the /userhome flag:

IIS Express could no longer locate the aspnet.config file, because %IIS_USER_HOME% variable that IIS Express uses became invalid. This caused errors when trying to run a web service from IIS Express.

No solution could be found to the problem, apart from programmatically hard coding the applicationHost.config file in the userhome directory to point to the aspnet.config file. This involved simply searching for instances of %IIS_USER_HOME% and replacing them with the actual directory location. This was achieved by passing through the XML file to this C# method:
IIS Express applications are all defined in the relevant applicationHost.config file (in the userhome directory – either the default one or the one you manually specified).

Running IIS Express between multiple users
Running IIS Express between multiple users

Programmatically adding an application to IIS Express

Adding an application is as simple as adding a site node to the sites node in the config file. The physicalPath attribute points to the path containing the web application’s files.
Whether using C# or any other language to launch IIS Express, the principles remain the same.

Programmatically adding an application
Programmatically adding an application

Programmatically launching IIS Express applications

Simply run iisexpress.exe from its installation directory with two flags:

- /userhome:[userhome], filling in the userhome directory you’ve chosen

- /site:[site], filling in the site name you chose for this web application

This does the following:

- Launches IIS Express, if it is not already running.

- Creates the userhome directory with the required configuration files, if it has not yet been created.

- Attempts to open the specified site. This will output an error to the console if the site does not exist.
Through IIS Express’s XML configuration file, programmatic manipulation of IIS Express is simple and enables you to take control of IIS Express for the user, simplifying deployment of any applications you have that need to be hosted on the user’s computer.


With a few minor hiccups, we managed to create a system to automatically deploy and use IIS Express to host our web applications in Stadium 5. The installation process of Stadium 5 has shortened to just one step, and no web server setup is required. Stadium 5 serves as a layer between the user and IIS express, nullifying the need for users to interact with their web server settings.

Although IIS Express is relatively new and free to use, it is most definitely suitable for basic business functionality, and very beneficial in our case. If your clients don’t need to get their hands dirty with their web server software, it might be a viable option to go with IIS Express and programmatically deal with the configuration yourself.

Email Us

Fill in your details and message below to contact us directly