如何设置wix v3 iis webAppPool标识属性?
问题描述:
如何设置wix v3 iis webAppPool标识属性?
我希望把所有更多钞票值,从应用程序池的身份,在WiX的下拉菜单。我无法将APP_POOL_IDENTITY分配给来自iis的Identity属性:WebAppPool。
我想删除约束这些元素:
的IIS:WebAppPool/@身份属性的值,“[APP_POOL_IDENTITY]”,是不是法律选项之一:“network服务”,“本地服务”,“ localSystem“,”其他“或”applicationPoolIdentity“。
答
这与Can I allow a user to choose either applicationPoolIdentity or specify a user using WiX-IIS extension?类似,但答案稍微复杂一些。
是的,这是可能的,但您需要创建一个组件组,其中包含作为组件的每个可能的xml属性组合。每套组件都需要自己的ID,GUID等。从用户界面填写选项,您可以确定要安装哪个组件。由于此解决方案有点冗长,我建议将它放在单独的文件中。
下面是两个需要不同属性的选项的示例,一个用于自定义应用程序池用户,一个用于applicationPoolIdentity。使用“CustomUser”组件作为您需要的任何进一步自定义选项的模板。请注意,如果WiX XML将发生更改,则只需指定其他组件,而不仅仅是更改属性值。基于https://www.codeproject.com/Articles/115036/Creating-WIX-Installer-for-ASP-NET-Web-Application。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<Property Id="IIS_WEBSITE" Value="root"/>
<Property Id="VIRTUAL_DIR_VAL" Value="myappdir" />
<!-- +++++++++++++++++++ web app name properties initialize ++++++++++++++++++++ -->
<Property Id="WEB_APP_NAME" Value="myapp" />
<Property Id="WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY" Value="1" />
<!-- +++++++++++++++++++ app pool identity properties initialize +++++++++++++++ -->
<Property Id="WEB_APP_POOL_IDENTITY_DOMAIN" Value="domain" />
<Property Id="WEB_APP_POOL_IDENTITY_NAME" Value="user" />
<Property Id="WEB_APP_POOL_IDENTITY_PWD" Hidden="yes" />
<!-- Reference to IIS Website to install to, but not create -->
<iis:WebSite Id='rootwebsite'
Description='[IIS_WEBSITE]'
Directory='INSTALLFOLDER'>
<!-- This element has to be here or WiX does not compile. It’s ignored
in this case. -->
<iis:WebAddress Id="AllUnassignedHTTP" Port="80" />
<iis:WebAddress Id="AllUnassignedHTTPS" Port="443" />
</iis:WebSite>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="InstallWebsiteCustomUser" Guid="[guid]" KeyPath="yes" Win64="yes">
<Condition><![CDATA[WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY = 1]]></Condition>
<util:User Id="WebAppPoolUser"
CreateUser="no"
Name="[WEB_APP_POOL_IDENTITY_NAME]"
Password="[WEB_APP_POOL_IDENTITY_PWD]"
Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]" />
<iis:WebAppPool Id="WebAppPoolCustom"
Name="[WEB_APP_NAME]"
Identity="other"
User="WebAppPoolUser"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"
RecycleMinutes="200" />
<iis:WebVirtualDir Id="WebVirtualDirCustom"
Alias="[VIRTUAL_DIR_VAL]"
Directory="INSTALLFOLDER"
WebSite="rootwebsite">
<!-- Turn the Virtual Directory into a web application. -->
<iis:WebApplication Id="WebApplicationCustom"
Name="[WEB_APP_NAME]"
WebAppPool="WebAppPoolCustom" />
</iis:WebVirtualDir>
</Component>
<Component Id="InstallWebsite" Guid="[guid]" KeyPath="yes" Win64="yes">
<Condition><![CDATA[WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY <> 1]]></Condition>
<iis:WebAppPool Id="WebAppPool"
Name="[WEB_APP_NAME]"
Identity="applicationPoolIdentity"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"
RecycleMinutes="200"/>
<iis:WebVirtualDir Id="WebVirtualDir"
Alias="[VIRTUAL_DIR_VAL]"
Directory="INSTALLFOLDER"
WebSite="rootwebsite">
<!-- Turn the Virtual Directory into a web application. -->
<iis:WebApplication Id="WebApplication"
Name="[WEB_APP_NAME]"
WebAppPool="WebAppPool" />
</iis:WebVirtualDir>
</Component>
</DirectoryRef>
<ComponentGroup Id="IisConfiguration">
<ComponentRef Id="InstallWebsiteCustomUser" />
<ComponentRef Id="InstallWebsite" />
</ComponentGroup>
</Fragment>
</Wix>