gpt4 book ai didi

iis - WiX-Bundle 安装后如何激活 IIS 功能?

转载 作者:行者123 更新时间:2023-12-02 17:53:20 25 4
gpt4 key购买 nike

我已经制作了一个 WiX-Bootstrapper bundle ,其中包含一些先决条件,例如 IIS Express 8.0。在虚拟机上安装 IIS 进展顺利。在下一步中,我想激活一些 IIS 功能。所以我在 MSI 项目的 Product.wxs 中尝试了以下几行:

<Product>
[...]
<Property Id="INSTALLIISPROP"
Value="C:\Windows\System32\dism.exe"></Property>
<CustomAction Id="InstallIISCA"
Return="check"
Property="INSTALLIISPROP"
Execute="deferred"
HideTarget="yes"
Impersonate="yes"
ExeCommand="/Online /Enable-Feature /FeatureName:IIS-WebServerRole /FeatureName:IIS-WebServer /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-StaticContent /FeatureName:IIS-DefaultDocument /FeatureName:IIS-RequestFiltering /FeatureName:IIS-IPSecurity [...]></CustomAction>
<InstallExecuteSequence>
<Custom Action="InstallIISCA"
Before="InstallFinalize">
<![CDATA[NOT Installed AND IISMAJORVERSION]]>
</Custom>
</InstallExecuteSequence>
</Product>

但这没有任何作用。没有激活任何 IIS 功能。我做错了什么?

最后是 IIS 安装的 WXS 文件:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\InetStp\Components"
Value="Install"
Variable="IisExpressX64"
Win64="yes"/>
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\InetStp\Components"
Value="Install"
Variable="IisExpressX86"/>

<PackageGroup Id="IisExpress_8_0">
<MsiPackage Id="IisExpress8_0_X64"
Cache="yes"
Compressed="yes"
Permanent="yes"
Vital="yes"
SuppressSignatureVerification="yes"
SourceFile=".\Prerequisites\iis\iisexpress_8_0_RTM_x64_de-DE.msi"
InstallCondition="NOT IisExpressX86 AND VersionNT64"/>

<MsiPackage Id="IisExpress8_0_X86"
Cache="yes"
Compressed="yes"
Permanent="yes"
Vital="yes"
SuppressSignatureVerification="yes"
SourceFile=".\Prerequisites\iis\iisexpress_8_0_RTM_x86_de-DE.msi"
InstallCondition="NOT IisExpressX86 AND NOT VersionNT64"/>
</PackageGroup>
</Fragment>
</Wix>

并且它在Bundle.wxs中被引用:

<PackageGroupRef Id='IisExpress_8_0'/>

最佳答案

要解决该问题,您需要第二个包含 ExePackages 的 WXS 文件,它将激活 IIS 功能。然后你必须在 Bundle 中实现另一个 PackageGroupRef。

这里是具有 IIS 功能的 WXS:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<PackageGroup Id='ActivateIisFeatures'>
<ExePackage Id='IIS_WebserverRole'
DisplayName='Installing IIS: IIS-WebServerRole'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-WebServerRole'>
</ExePackage>
<ExePackage Id='IIS_WebServer'
DisplayName='Installing IIS: IIS-WebServer'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-WebServer'>
</ExePackage>
<ExePackage Id='IIS_CommonHttpFeatures'
DisplayName='Installing IIS: IIS-CommonHttpFeatures'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-CommonHttpFeatures'>
</ExePackage>
<ExePackage Id='IIS_StaticContent'
DisplayName='Installing IIS: IIS-StaticContent'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-StaticContent'>
</ExePackage>
<ExePackage Id='IIS_DefaultDocument'
DisplayName='Installing IIS: IIS-DefaultDocument'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-DefaultDocument'>
</ExePackage>
<ExePackage Id='IIS_DirectoryBrowsing'
DisplayName='Installing IIS: IIS-DirectoryBrowsing'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-DirectoryBrowsing'>
</ExePackage>
<ExePackage Id='IIS_HttpErrors'
DisplayName='Installing IIS: IIS-HttpErrors'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-HttpErrors'>
</ExePackage>
<ExePackage Id='IIS_HttpRedirect'
DisplayName='Installing IIS: IIS-HttpRedirect'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-HttpRedirect'>
</ExePackage>
<ExePackage Id='IIS_ApplicationDevelopment'
DisplayName='Installing IIS: IIS-ApplicationDevelopment'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment'>
</ExePackage>

<!--NetFx4Extended-ASPNET45-->
<!--Some features like IIS-NetFxExtensibility, IIS-NetFxExtensibility45, IIS-ASPNET, IIS-ManagementService and WAS-NetFxEnvironment are dependent from this one.-->
<ExePackage Id='NetFx4Extended_ASPNET45'
DisplayName='Installing IIS: NetFx4Extended-ASPNET45'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:NetFx4Extended-ASPNET45'>
</ExePackage>

<ExePackage Id='IIS_NetFxExtensibility'
DisplayName='Installing IIS: IIS-NetFxExtensibility'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-NetFxExtensibility'>
</ExePackage>
<ExePackage Id='IIS_NetFxExtensibility45'
DisplayName='Installing IIS: IIS-NetFxExtensibility 4.5'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-NetFxExtensibility45'>
</ExePackage>
<ExePackage Id='IIS_ISAPIExtensions'
DisplayName='Installing IIS: IIS-ISAPIExtensions'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ISAPIExtensions'>
</ExePackage>
<ExePackage Id='IIS_ASP'
DisplayName='Installing IIS: IIS-ASP'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ASP'>
</ExePackage>
<ExePackage Id='IIS_ISAPI_Filter'
DisplayName='Installing IIS: IIS-ISAPI-Filter'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ISAPIFilter'>
</ExePackage>
<ExePackage Id='IIS_ASPNET'
DisplayName='Installing IIS: IIS-ASP.NET'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ASPNET'>
</ExePackage>
<ExePackage Id='IIS_ASPNET45'
DisplayName='Installing IIS: IIS-ASP.NET45'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ASPNET45'>
</ExePackage>
<ExePackage Id='IIS_HealthAndDiagnostics'
DisplayName='Installing IIS: IIS-HealthAndDiagnostics'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-HealthAndDiagnostics'>
</ExePackage>
<ExePackage Id='IIS_HttpLogging'
DisplayName='Installing IIS: IIS-HttpLogging'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-HttpLogging'>
</ExePackage>
<ExePackage Id='IIS_LoggingLibraries'
DisplayName='Installing IIS: IIS-LoggingLibraries'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-LoggingLibraries'>
</ExePackage>
<ExePackage Id='IIS_RequestMonitor'
DisplayName='Installing IIS: IIS-RequestMonitor'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-RequestMonitor'>
</ExePackage>
<ExePackage Id='IIS_HttpTracing'
DisplayName='Installing IIS: IIS-HttpTracing'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-HttpTracing'>
</ExePackage>
<ExePackage Id='IIS_CustomLogging'
DisplayName='Installing IIS: IIS-CustomLogging'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-CustomLogging'>
</ExePackage>
<ExePackage Id='IIS_Security'
DisplayName='Installing IIS: IIS-Security'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-Security'>
</ExePackage>
<ExePackage Id='IIS_WindowsAuthentication'
DisplayName='Installing IIS: IIS-WindowsAuthentication'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-WindowsAuthentication'>
</ExePackage>
<ExePackage Id='IIS_RequestFiltering'
DisplayName='Installing IIS: IIS-RequestFiltering'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-RequestFiltering'>
</ExePackage>
<ExePackage Id='IIS_IPSecurity'
DisplayName='Installing IIS: IIS-IPSecurity'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-IPSecurity'>
</ExePackage>
<ExePackage Id='IIS_Performance'
DisplayName='Installing IIS: IIS-Performance'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-Performance'>
</ExePackage>
<ExePackage Id='IIS_HttpCompressionStatic'
DisplayName='Installing IIS: IIS-HttpCompressionStatic'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-HttpCompressionStatic'>
</ExePackage>
<ExePackage Id='IIS_WebServerManagementTools'
DisplayName='Installing IIS: IIS-WebServerManagementTools'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-WebServerManagementTools'>
</ExePackage>
<ExePackage Id='IIS_ManagementConsole'
DisplayName='Installing IIS: IIS-ManagementConsole'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ManagementConsole'>
</ExePackage>
<ExePackage Id='IIS_ManagementScriptingTools'
DisplayName='Installing IIS: IIS-ManagementScriptingTools'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ManagementScriptingTools'>
</ExePackage>
<ExePackage Id='IIS_ManagementService'
DisplayName='Installing IIS: IIS-ManagementService'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:IIS-ManagementService'>
</ExePackage>
<ExePackage Id='WAS_WindowsActivationService'
DisplayName='Installing IIS: WAS-WindowsActivationService'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:WAS-WindowsActivationService'>
</ExePackage>
<ExePackage Id='WAS_ProcessModel'
DisplayName='Installing IIS: WAS-ProcessModel'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:WAS-ProcessModel'>
</ExePackage>
<ExePackage Id='WAS_NetFxEnvironment'
DisplayName='Installing IIS: WAS-NetFxEnvironment'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:WAS-NetFxEnvironment'>
</ExePackage>
<ExePackage Id='WAS_ConfigurationAPI'
DisplayName='Installing IIS: WAS-ConfigurationAPI'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:WAS-ConfigurationAPI'>
</ExePackage>
<ExePackage Id='IIS_NetFx3'
DisplayName='Installing IIS: NetFx3'
PerMachine='yes'
SourceFile='.\Resources\Dism.exe'
InstallCommand='/Online /Enable-Feature /FeatureName:NetFx3'>
</ExePackage>
</PackageGroup>
</Fragment>
</Wix>

至少还有 PackageGroupRef:

<PackageGroupRef Id='ActivateIisFeatures'/>

关于iis - WiX-Bundle 安装后如何激活 IIS 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26780915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com