IIS Express Bootstrapper Package

As I mentioned in a previous post, the IIS 7.5 Express MSI can be redistributed with your software package. This is enabled by the license agreement so you don’t need any additional approval. When your software is being installed on a customer’s machine, you’ll want to install IIS Express as a prerequisite, if it isn’t already present. Installer dependencies on redistributable components, such as IIS Express, are typically handled using Bootstrapper Packages.

IIS Express doesn’t officially provide a Bootstrapper Package. This is not a showstopper since you can create one yourself. See the following links, for example.

Creating Bootstrapper Packages

Application Deployment Prerequisites

For reference, I am including a Bootstrap Package for IIS Express as a part of this blog post. The zip file includes some XML manifests that will allow you to include IIS Express as a prerequisite for your setup package.

Disclaimer: The bootstrapper package is provided as-is, as a sample only. It is not officially supported. I have only verified that some simple cases work correctly. Please be sure to review and modify it as appropriate, and test it more thoroughly.

Relying on this manifest won’t bundle the IIS Express MSI with your package. Instead, when the user runs your setup program, the Windows installer will download and install IIS Express from Microsoft Download Center, if it isn’t already installed. This is fine if you are distributing your software over the internet and/or if your customers will be connected to the internet when they install your package. It makes your package leaner too, which is a good thing.

You can modify the manifest to include the IIS Express MSI. I won't describe how to do this in this blog post. Take a look at the MSDN links provided above for additional information.

Installing the Sample

To install the bootstrapper package on your machine, simply extract the zip file to the bootstrapper folder location. This folder contains bootstrapper packages for other Microsoft redistributable components, such as .NET 4.0.

On my 64-bit computer running Windows 7, this location is C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages.

If you can’t find the above location, check the Path value under one of the following registry keys, depending on your architecture.

  • HKLM\SOFTWARE\Microsoft\GenericBootstrapper\4.0 for 64-bit machines
  • HKLM\SOFTWARE\Wow6432Node\Microsoft\GenericBootstrapper\4.0 for 34- bit machines.

A new IISExpress7.5 directory will show up under the Packages folder and will contain the product and package manifests for IIS Express.

Using the Sample

Here are steps to include IIS Express as a required component for your setup program in Visual Studio 2010.

- Launch your setup project in Visual Studio 2010

- In Solution Explorer, right-click your project and click Properties.

image

- Click the Prerequisites Button in the Properties dialog.

image

- In the ensuing dialog, select IIS Express as a prerequisite in addition to any others, as shown below. Also, make sure .NET 4.0 is checked since IIS Express requires it.

image

- Build your project.

Visual Studio will build a MSI as well as a setup.exe bootstrapper program. In order to make sure all prerequisites get installed, make sure your customers run setup.exe.

I hope this is useful and look forward to your feedback.

15 Comments


  • The IIS Express license doesn't cover other components like media services. You'll need to review those licenses separately (I don't believe the media services one allows redistributable).

  • CrossDomain Access Policy Error while accessing Services from Silverlight App. I placed clientAccessPolicy.xml and CrossDamin.xml in root of IISExpress. Its working fine with IIS.
    Any Idea?


  • >>CrossDomain Access Policy Error while accessing Services from Silverlight App ...

    zenhgjjh, did you place clientAccessPolicy.xml or crossdomain.xml file in the service root folder? Placing it in the IIS Express root folder won't help. Let me know if you still see issues.

  • I tried in both ways as you mentioned. here is my xml file content

















  • Its working fine after changing clientaccesspolicy.xml to.














  • Vaidy,

    I am runing IIS Express from Command Line to host services by using the Folder Path. Is there any way to hide the Command Prompt if I close command prompt IIS Express is also stopped.

  • >> I am runing IIS Express from Command Line to host services by using the Folder Path. Is there any way to hide the Command Prompt if I close command prompt IIS Express is also stopped.

    Not right now, unfortunately. But you can easily write an exe wrapper that hides the console. Let me know if you need more details. We'll definitely consider this for the future.


  • can i get the some details regarding hides the console.

  • >> can i get the some details regarding hides the console

    Just use Process.Start with the appropriate arguments: http://msdn.microsoft.com/en-us/library/0w4h05yb.aspx

    In the ProcessStartInfo object, make sure UseShellExecute is set to false. Also be sure to redirect standard output and standard error to files. I hope this helps.

  • @zenhgjjh

    One more note. To shutdown IIS Express cleanly, just send it a WM_QUIT message.

  • Not able to hide the console window

    private void Form1_Load(object sender, EventArgs e)
    {
    ProcessStartInfo start = new ProcessStartInfo();
    start.WindowStyle = ProcessWindowStyle.Hidden;
    start.UseShellExecute = false;
    start.FileName = @"C:\Documents and Settings\Sample.bat";

    start.Arguments = @"C:\Documents and Settings\ServicesFolder";
    Process.Start(start);
    }

  • Can you try setting RedirectStandardOutput and RedirectedStandardError members in ProcessStartInfo to true?

  • Thanks for Reply,

    I am only able to hide the content of console by using RedirectStandardOutput and RedirectedStandardError to True IIS is Runing. By setting WindowStyle = ProcessWindowStyle.Hidden able to Close console window but IIS is also Exited(Stopped)

    CODE::
    ProcessStartInfo start = new ProcessStartInfo();
    start.FileName = @"C:\Documents and Settings\Sample.bat";
    start.Arguments = @"""" + @"C:\Documents and Settings\Services" + @"""";
    start.RedirectStandardOutput = true;
    start.RedirectStandardError = true;
    //start.WindowStyle = ProcessWindowStyle.Hidden;
    start.UseShellExecute = false;
    Process.Start(start);
    Any Idea

  • It's much harder to make IIS Express a redistributable component than use UltiDev Web Server Pro (UWS) - a redistributable-by-design web server that already makes itself a prerequisite for InstallShield and Visual Studio setup project.

    http://UltiDev.com/Products/UWS/

    Besides being freely small and redistribtatble,
    - UWS can serve external requests.
    - It has no dependency on .NET Framework 4.0 while fully supporting ASP.NET applications if .NET 4 is installed.
    - It's much smaller - about 1.5 MB download and no external dependencies.
    - It can be used to debug ASP.NET applications right from the Visual Studio.
    - It has much nicer UI compared to IIS.
    - It is free, very advanced and is getting improved quickly.

  • Useful article, I've got a need to install a local version of a website on a client machine and this will indeed be helpful.

    Two quick questions I was hoping you could point me in the right direction of:

    1. The version of IIS I downloaded from MSDN seems not the match the public key and hash in product.xml, is there a simple way to derive this information from a different .msi file?

    2. After setting up IIS I will need to take things a step further and set up either a website/virtual directory to run through the IIS install, are you aware of a similar tutorial for this setup procedure (ideally from a setup project) rather than doing this from inside a separate app? or any additional pointers on this area?

    Many thanks

Comments have been disabled for this content.