This article describes a detailed procedure for installing a new web application on an existing IIS website, when Wix3 is used to create the msi file. This can be a common requirement in a large deployment. However, I find it's a lot of work to actually get it done,
1 The Requirement
The SFS application I am working on used to have a fixed installation directory under the Default Web Site which is "C:\inetput\wwwroot\SFS". And one day we got a message from our deployment team:
Installing a new (or existing) web application into our Production cluster may seem like a simple thing, but believe me, there are a variety of things that make it just complex enough to need to be explained and just complex enough that the MSI you create to install an application needs to be smarter than you think.
- First of all, an application gets installed into a web site. Our Production servers have more than one web site on them: Intranet, Extranet, Public, etc. When your setup program tries to install itself, if it does not specify a particular web site it will "choose" the first one that it gets from IIS. This is most likely the Default Web Site, but not always, and, depending upon the accessibility of the application (Extranet vs. Intranet) it may not even be the correct site. If it is not the correct site we have to try and move it from one site to another, but any special configuration that may have occurred may not be moved over causing no end of grief for both you and us. As a result, your setup program needs to query IIS with regard to the web sites that are available and provide a drop down list to the person doing the installation so that they can pick the correct site.
- Next, an application needs to tell us which Virtual Directory it needs to get installed in. Pretty straight forward. Your setup program needs to prompt for this with the default being where you are expecting it to be.
- OK, next step, application pool. While applications don't need their own application pool it makes things a lot easier to troubleshoot and manage if they do. As a result, the setup program needs to prompt for the Application Pool that the application should be using after it is installed.
- Also finished. If your setup program makes changes to config files based on the environment (thank you!!!) then you need to provide a list of environments for which you can make changes. A drop down list, a set of radio buttons, anything that allows us to pick an environment would be preferred as opposed to a free form text field. If it is free form , do you want "Production", "PROD", "Prod" or "P"? Things should be as simple as possible.
- Last thing: is there some way to run your MSI in an automated fashion, without human intervention? What if we used a different process for installing your application and had automated deployments set up for 4:00 AM. How do we set all of the parameters for your application? Can it be done? Think about it.
And below was the sample screen they gave me:
Note: To install in the root directory of the selected website, leave the Virtual Directory field empty. Or, you can specify the Virtual Directory to create/update a virtual directory under the selected website.
2 Microsoft Fix
Microsoft actually released a fix to provide a solution for this problem:
"FIX: You cannot deploy a Web Setup project to Web sites by using