Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX not configuring IIS site correctly

I have an installer which configures 2 websites, one of which has some applications under the root site. The top level site is configured for Windows Authentication only, as below:

<iis:WebSite Id="WebSite"
             Description="Application"
             Directory="WEBSITE_INSTALLLOCATION"
             AutoStart="yes"
             ConfigureIfExists="yes"
             StartOnInstall="yes">

        <iis:WebAddress Id="AllUnassigned" Port="80" />

        <iis:WebApplication Id="WebApplication"
                            Name="Console"
                            WebAppPool="WebAppPool"/>

        <iis:WebDirProperties Id="WebProperties"
                              AnonymousAccess="no"
                              WindowsAuthentication="yes"
                              AuthenticationProviders="NTLM,Negotiate"/>

</iis:WebSite>

Other (optional) components in the installer then declare applications/virtual directories as follows:

<iis:WebVirtualDir Id="HelpWebSite" Alias="Help" Directory="ApexHelpDir" WebSite="WebSite">
    <iis:WebApplication Id="HelpApp" Name="Help" WebAppPool="WebAppPool"/>
    <iis:WebDirProperties Id="HelpProps" AnonymousAccess="yes" WindowsAuthentication="no"/>
</iis:WebVirtualDir>

The behaviour I'm seeing is what I'd expect 9/10 times, but intermittently the installer will install the "Website" site with both anonymous authentication and windows authentication, rather than just the Help application with anonymous authentication. The only explanation for this that I can think of is that the act of adding a virtual directory/application underneath a root site occasionally causes the root to inherit the child authentication settings as well as its own.

Note: I tried to raise this as a bug on the wixtoolset.org site, but kept getting an error when trying to do so.

like image 564
Joe Avatar asked Sep 25 '13 13:09

Joe


1 Answers

Alternatively, you can write a batch script to create a website and call from WIX as custom action.

Batch file

%systemroot%\system32\inetsrv\appcmd.exe add site /name:YourWebSite /PhysicalPath:%systemdrive%\inetpub\wwwroot /bindings:http/*:80:

WIX(product.wxs)

<CustomAction Id="CreateWebsite" Execute="deferred" Impersonate="no" Return="check" Directory="TARGETDIR" PatchUninstall="no" ExeCommand="Batchfilepath" />

<InstallExecuteSequence>
<Custom Action="CreateWebsite" Before="InstallFinalize">NOT Installed AND NOT PATCH</Custom>
</InstallExecuteSequence>

Change your ExeCommand attribute value to point to the correct batch file path.

like image 200
Hadoop-Guy Avatar answered Nov 01 '22 21:11

Hadoop-Guy