WebAppPool fails if AppPool already exists - WiX 3.5

2

This was working in WiX 3.0.

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="inetpubDir" Name="inetpub">
    <Directory Id="wwwrootDir" Name="wwwroot">
      <Directory Id="INSTALLDIR" Name="DS3000Services" FileSource="\Server\Implementation\DS3000Services\Web">
        <Component Id="DS3000ServicesVirtualDir" Guid="{4EFD7047-09F4-42e7-ACB5-A209D26B0338}">
          <CreateFolder />
          <iis:WebAppPool Id="AppPool" Name="[AppPoolName]" Identity="other" User="PortalUser" IdleTimeout="0" RecycleMinutes="0">
            <iis:RecycleTime Value="1:00" />
          </iis:WebAppPool>
          <iis:WebVirtualDir Id="DS3000ServicesVirtualDir" Alias="[VIRTUALDIR]" Directory="INSTALLDIR" WebSite="DefaultWebSite">
            <iis:WebApplication Id="DS3000ServicesApp" Name="DS3000 Services" Isolation="medium" WebAppPool="AppPool" />
          </iis:WebVirtualDir>
        </Component>

Install Log:

MSI (s) (10:E8) [09:57:58:553]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI14A0.tmp, Entrypoint: WriteIIS7ConfigChanges
WriteIIS7ConfigChanges:  Error 0x800700b7: Failed to add appPool element
WriteIIS7ConfigChanges:  Error 0x800700b7: Failed to configure IIS appPool.
WriteIIS7ConfigChanges:  Error 0x800700b7: WriteIIS7ConfigChanges Failed.
CustomAction WriteIIS7ConfigChanges returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (10:4C) [09:57:58:585]: User policy value 'DisableRollback' is 0
MSI (s) (10:4C) [09:57:58:585]: Machine policy value 'DisableRollback' is 0
Action ended 9:57:58: InstallFinalize. Return value 3.

Installing on Win Server 2008 R2. The AppPool already exists. If I remove the AppPool, the installer succeeds. Any thoughts? Thanks...

wix
wix3.5
asked on Stack Overflow Jan 18, 2011 by Mike Ward • edited Mar 31, 2012 by Wim Coenen

1 Answer

1

I would recommend you to create a customAction for creating virtual directory along with Application Pool.

I have used custom action in my project for that purpose. In the custom action you can check whether the application pool with the given name exists or not.

Added inbuilt commands

<Component Id="VDWeb" Guid="493E3487-AA4C-4476-8CC0-4B1C763AF6F7" Permanent="no">
    <iis:WebVirtualDir Id="VDir" Alias="[VDNAME]" Directory="dir_Application_0" WebSite="WebSelectedWebSite">
        <iis:WebApplication Id="WebApp" Name="[VDNAME]" WebAppPool="ABCAppPool" />
    </iis:WebVirtualDir>
    <RegistryKey Root="HKLM" Action="createAndRemoveOnUninstall" Key="SOFTWARE\ABC\[ProductCode]\VirtualDirectory">
        <RegistryValue Name="VDName" Type="string" Value="[VDNAME]"/>
    </RegistryKey>
</Component>

<Component Id="AppPool_1" Guid="414a377f-e044-49d5-b905-66bf3da6489f" Permanent="no">
    <util:User Id="PoolAccount" Domain="[DOMAINNAME]" Name="[LogonUser]" Password="[NT_PASSWORD]" CreateUser="no">
        <util:GroupRef Id="IISUsersGroup"/>
    </util:User>

    <iis:WebAppPool Id="ABCAppPool_NT" Name="[APPPOOLNAME_NT]" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" Identity="other" User="PoolAccount">
        <iis:RecycleTime Value="05:00" />
    </iis:WebAppPool>
</Component>

<util:Group Id="IISUsersGroup" Name="IIS_IUSRS"/>

<iis:WebSite Id="WebSelectedWebSite" Description="[WEB_WEBSITE_DESCRIPTION]">
  <iis:WebAddress Id="AllUnassigned1" Port="[WEB_WEBSITE_PORT]" IP="[WEB_WEBSITE_IP]" Header="[WEB_WEBSITE_HEADER]" />
</iis:WebSite>

Am using this and it works perfectly fine.

answered on Stack Overflow Mar 27, 2011 by Sunil Agarwal • edited Sep 12, 2011 by Sunil Agarwal

User contributions licensed under CC BY-SA 3.0