WIX-支持IIS上的Web应用程序的多个实例



我正在使用wix创建我的msi安装程序。安装程序将在IIS中创建一个新的应用程序池和虚拟目录来运行我的web应用程序。

现在,我正试图在同一台机器上同时拥有多个web应用程序实例(相同版本或更高版本)。

-Wix支持这样的东西吗?

-我可以在每次安装时动态创建多个应用程序池和虚拟目录吗?因为目前appPool的名称、虚拟目录和目标文件夹都是硬编码在Product.WXS文件中的。

我认为你甚至不能多次执行安装,它只会尝试卸载、修改或修复你以前的安装或执行升级。但关于应用程序池或网站名称,您可以在安装过程中在功能选择对话框中指定它,并在文本框中写下网站或应用程序池的名称

<Control Id="WebsiteName" Type="Text" X="..." Y="..." Width="..." Height="..."  Text="Website name :" Indirect="no" >
      <Condition Action="hide">Installed</Condition>
    </Control>
    <Control Id="WebsiteName" Type="Edit" X="..." Y="..." Width="..." Height="..." Property="WEBSITENAME" Text="{50}" Indirect="no" >
      <Condition Action="hide">Installed</Condition>
</Control> 

您需要在Product.wxs 上指定您的财产

<Property Id="WEBSITENAME" Value="YourDefaultWebSiteName" Secure="yes">
  <RegistrySearch Id="FindWebSiteName" Root="HKCU"
                  Key="SOFTWAREYourCompanyYourProduct"
                  Name="WebsiteName" Type="raw"/>
</Property>
<Property Id="APPPOOL" Value="0" Secure="yes">
  <RegistrySearch Id="FindWixSetupInstallation" Root="HKCU"
                  Key="SOFTWAREYourCompanyYourProduct"
                  Name="webAppPool" Type="raw"/>
</Property>

然后你需要在你创建应用程序池和网站名称的设置中指定它

<iis:WebSite Id="DefaultWebSite" Description="Default Web Site">
  <iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
<DirectoryRef Id="YourDirectory" >
  <Component Id="CMP_CONFIG" Guid="{YOURGUID}" KeyPath="yes">
    <iis:WebVirtualDir Id="WebsiteName" Alias="[WEBSITENAME]" Directory="YourDirectory" WebSite="DefaultWebSite">
      <iis:WebApplication Id="YourApplicationApp" Name="[WEBSITENAME]" WebAppPool="[WEBSITENAME]" />
      <iis:WebDirProperties Id="YourApplicationDirProp" Script="yes" Execute="yes" Read ="yes" DefaultDocuments="Default.aspx"/>
    </iis:WebVirtualDir>
  </Component>
</DirectoryRef>

如果你想创建桌面的快捷方式

 <DirectoryRef Id="DesktopFolder">
      <Component Id="YourWebsiteAppDesktopShortcut" Guid="{YOURGUID}">       
        <RegistryValue Root="HKCU"
                      Key="SOFTWAREYourCompanyYourProduct"
                      Name="YourWebsiteApp"
                      Type="integer"
                      Value="1"
                      KeyPath="yes"/>
        <util:InternetShortcut Id="WebSiteDesktopShortcut"
                               Directory="DesktopFolder"  
                               Name="YourWebsiteAppName" 
                               Target="http://localhost/[WEBSITENAME]/" 
                               Type="url" />
        </Component>
    </DirectoryRef>

您只需要在Product.wxs 中注册所有这些组件引用ID

最新更新