3
votes

How do I specy that there already is the IIS Default Web Site? The Default Web Site must not be uninstalled. I just want to add a new Web Application with my WiX installer.

Unfortunately I didn't find any fitting samples. Everyone always seems to install and uninstall the whole thing.

EDIT:

<Fragment>
    <ComponentGroup Id="IIS">
        <Component Id="EEE" Directory="WCFFOLDER">
            <iis:WebVirtualDir Id="MyVirtualDir" Alias="MyVirtualDir" Directory="INSTALLDIR" WebSite="DEFAULTWEBSITE">
                <iis:WebApplication Id="DeploymentWebAppl" Name="MyName" WebAppPool="MyAppPool" />
            </iis:WebVirtualDir>
        </Component>
    </ComponentGroup>

    <iis:WebSite Id="DEFAULTWEBSITE" Description="Default Web Site" Directory="INSTALLDIR">
        <iis:WebAddress Id="AllUnassigned" Port="80" />
    </iis:WebSite>
    <iis:WebAppPool Id="MyAppPool" Name="MyAppPool"/>
</Fragment>

How do I specify that there also is an virtual directory? If I put the iis:WebApplication element directly into the Component I get the following error: "The Component element contains an unexpected child element 'iis:WebApplication"

What is the value of INSTALLDIR? I donÄt know where the Default Web SIte has its Directory (propably C:\intpub\wwwroot)

I want to do the same in my WiX installer as in the following C# code I have

using (ServerManager manager = new ServerManager())
{
   var site = manager.Sites["Default Web Site"];
   var application = site.Applications.CreateElement();
   application.Path = "C:\ProgramFiles\.....";
   application.EnabledProtocols = "http,net.tcp";
   application.ApplicationPoolName = "MyAppPool";
   site.Applications.Add(application);

   manager.CommitChanges();
}
1
What does this have to do with WCF? - Tim
I want to install WCF services - Antineutrino

1 Answers

4
votes

See the example code here: Install a New Virtual Directory to Default Web Site with WiX.

Rephrasing it: if you put your <iis:WebSite> element inside <Component> element, then the website is managed by MSI and removed when uninstalling. If not, then the website element is a placeholder, and it is not touched by uninstall.