How to add an application to an existing IIS site using WiX

I want to add an application to an existing IIS site, which is not the default IIS site. This is not an ordinary request, but it is necessary when deploying to SBS for Windows 2008, therefore, for the web applications to work correctly, MVC Web APIs must be moved to SBS Web Applications.

In IIS, I would right-click in SBS Web Applications> Add Application ... and set an alias, application pool, and physical path.

Wix does not allow me to set these properties in IIS: WebApplication, and even more it seems that I need to use IIS: WebVirtualDir, but I do not want to do this. I just need to specify the Physical Path attribute where my API is set for this.

Why can't I tell WiX IIS: WebApplication - The Alias ​​and Path that I want according to the IIS interface?

Of all the WiX work that I did, I would think that this would be one of the easiest things to do.

Note. I want to create an application, I do not want or should not create a site - it already exists.

+5
source share
1 answer

You can achieve these goals with WIX. I have an even more complicated option: installing either on a new website or on an existing one for IIS 6, IIS 7, and IIS 7.5.

-, WIX SiteId. , , * . siteId Description, .

(, , ):

<PropertyRef Id="FRAMEWORKROOT"/>

<PropertyRef Id="SITE_INSTALL_MODE"/>
<PropertyRef Id="SITE_NAME"/>
<PropertyRef Id="SITE_PORT"/>
<PropertyRef Id="SITE_VIRT_DIR"/>
<PropertyRef Id="SITE_APP_NAME"/>
<PropertyRef Id="SITE_HEADER"/>
<PropertyRef Id="SITE_APP_POOL"/>
<PropertyRef Id="SITE_ID"/>

<Property Id="SITE_APP_NAME" Value="{ProductId}"/>

<iis:WebApplication Id="IIS6WebApp" Name="[SITE_APP_NAME]" WebAppPool="AppPool" >
  <iis:WebApplicationExtension Verbs="GET,HEAD,POST" CheckPath="no" Script="yes" Executable="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" />
</iis:WebApplication>

<iis:WebApplication Id="Iis7WebApp" Name="[SITE_APP_NAME]" WebAppPool="AppPool"></iis:WebApplication>

<iis:WebSite Id="ExistingWebSite" Description="[EXISTING_SITE_NAME]" SiteId="*">
  <iis:WebAddress Id="ExistingSite_IIS7_Header_Binding" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>

<util:Group Id="IisUsersGroup" Name="[IisGroup]" Domain="[ComputerName]"/> 

<DirectoryRef Id="SITE_INSTALLDIR">
  <Component Id="AppPoolConfigure" Guid="YOURGUID-5549-48E8-B989-AFC61D279527" KeyPath="yes" Permanent="no">
    <util:User Id="SiteUser" Domain="[APP_USER_DOMAIN]" Name="[APP_USER_NAME]" Password="[APP_USER_PASSWORD]" CreateUser="no" UpdateIfExists="no" RemoveOnUninstall="no">
      <util:GroupRef Id="IisUsersGroup"/>
    </util:User>

    <iis:WebAppPool Id="AppPool" Name="[SITE_APP_POOL]" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" Identity="other" User="SiteUser" />
  </Component>

  <Component Id="Iis6NewSiteConfigure" Guid="YOURGUID-8592-4E69-8D80-E42745307D7A" KeyPath="yes" Permanent="no">
    <Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "NewSite" AND IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
    <iis:WebSite Id="NewWebSite_IIS6" Description="[SITE_NAME]"
                 AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="no"
                 Directory="SITE_INSTALLDIR" ConnectionTimeout="360" SiteId="[SITE_ID]" 
                 DirProperties="WebDirProperties" WebApplication="IIS6WebApp">
      <iis:WebAddress Id="Site_IIS6_Header_Bindings" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
    </iis:WebSite>
  </Component>

  <Component Id="Iis6ExistingSiteConfigure" Guid="YOURGUID-8ECB-4AC3-95B1-B7287D0AC903" KeyPath="yes" Permanent="no">
    <Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "ExistingSiteNewVDir" AND IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
      <iis:WebVirtualDir Id="Site_IIS6_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]" WebSite="ExistingWebSite" 
                         DirProperties="WebDirProperties" WebApplication="IIS6WebApp"/>
  </Component>

  <Component Id="Iis6ConfigExtentions" Guid="YOURGUID-55F2-48E3-8B08-E37BA5137D8D" KeyPath="yes" Permanent="yes">
    <Condition><![CDATA[Installed OR (IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
    <iis:WebServiceExtension Id="ExtensionASP4" Group="ASP.NET v4.0.30319" Allow="yes" File="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" Description="ASP.NET v4.0.30319"/>
  </Component>

  <Component Id="Iis7NewSiteConfigure" Guid="YOURGUID-5DF6-4071-94F4-89D1EDAE8D90" KeyPath="yes" Permanent="no">
    <Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "NewSite" AND IISMAJORVERSION AND (IISMAJORVERSION > "#6"))]]></Condition>
    <iis:WebSite Id="WebSite_IIS7" Description="[SITE_NAME]"
                 AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="yes"
                 Directory="SITE_INSTALLDIR" ConnectionTimeout="360" SiteId="[SITE_ID]"
                 DirProperties="WebDirProperties" WebApplication="Iis7WebApp">
      <iis:WebAddress Id="NewSite_IIS7_Header_Binding" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
    </iis:WebSite>
  </Component>

  <Component Id="Iis7ExistingSiteConfigure" Guid="YOURGUID-FBBE-4379-8C7B-CDBD08EDCBA2" KeyPath="yes" Permanent="no">
    <Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "ExistingSiteNewVDir" AND IISMAJORVERSION AND (IISMAJORVERSION > "#6"))]]></Condition>
      <iis:WebVirtualDir Id="Site_IIS7_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]" WebSite="ExistingWebSite"
                         DirProperties="WebDirProperties" WebApplication="Iis7WebApp"/>
  </Component>
</DirectoryRef>

<ComponentGroup Id="IisSiteOrVDirCreate">
  <ComponentRef Id="AppPoolConfigure"/>
  <ComponentRef Id="Iis6NewSiteConfigure"/>
  <ComponentRef Id="Iis6ExistingSiteConfigure"/>
  <ComponentRef Id="Iis6ConfigExtentions"/>
  <ComponentRef Id="Iis7NewSiteConfigure"/>
  <ComponentRef Id="Iis7ExistingSiteConfigure"/>
</ComponentGroup>

<CustomAction Id="SetIisGroupToIUSRS" Property="IisGroup" Value="IIS_IUSRS" />
<CustomAction Id="SetIisGroupToWPG" Property="IisGroup" Value="IIS_WPG" />

<CustomAction Id="SetIisSiteUser" Property="IisSiteUser" Value="[APP_USER_DOMAIN]\[APP_USER_NAME]"/>

<InstallExecuteSequence>
  <Custom Action="SetIisGroupToIUSRS" After="AppSearch">IISMAJORVERSION>="#7"</Custom>
  <Custom Action="SetIisGroupToWPG" After="AppSearch">IISMAJORVERSION="#6"</Custom>
  <Custom Action="SetIisSiteUser" Before="InstallInitialize">1</Custom>
</InstallExecuteSequence> 
+4

All Articles