如果目标系统上尚未安装 .msi,我将使用以下自定义操作来安装 IIS 7。我收到以下错误,我的安装失败。我在我的 msi 中使用了很多 CA,并且都运行良好。但是对于这个我无法弄清楚问题可能是什么?直接在 cmd 提示符下执行此命令效果很好。任何人都可以就我做错了什么提供任何建议吗?请指教
目标操作系统:Windows 7 -32 位
自定义操作代码:
<Property Id="INSTALLIISPROP" Value="[SystemFolder]"></Property>
<CustomAction Id="InstallIISCA" Return="check" Property="INSTALLIISPROP" Execute="deferred" ExeCommand=" start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility; IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-WindowsAuthentication;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-WebServerManagementTools; IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;NetFx3"></CustomAction><InstallExecuteSequence><Custom Action="InstallIISCA" Before="InstallFinalize"><![CDATA[NOT Installed AND IISMAJORVERSION]]></Custom></InstallExecuteSequence>
我的日志文件中的错误:
错误 1721。此 Windows 安装程序包有问题。无法运行完成此安装所需的程序。请联系您的支持人员或软件包供应商。操作:安装 IISCA,位置:[SystemFolder],命令:启动 /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect ;IIS-应用程序开发;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS -安全;IIS-Windows身份验证;IIS-RequestFiltering;IIS-IPSecurity;IIS-性能;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;WAS-Windows激活服务;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;NetFx3
更多信息:我正在使用以下代码检查是否已安装 IIS
<Property Id="IISMAJORVERSION"><RegistrySearch Id="IISInstalledVersion" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Type="raw" Name="MajorVersion" /></Property><Condition Message="Error: This application requires IIS 7.0 to be installed. Please install IIS 7.0 and run this installer again.">IISMAJORVERSION</Condition>
在另一台机器上,这种情况为真,因为没有安装 IIS。但是在使用 msi 时,没有错误消息并且日志文件显示:MSI (s) (CC:F8) [15:32:00:761]: Skipping action: InstallIISCA (condition is false)?? 这怎么可能。
还在 C# 中创建了一个备用 CA,但它也因 Windows 包管理器错误而失败:操作失败
[CustomAction]
public static ActionResult InstallIIS(Session session)
{
try
{
Process proc = new Process();
string cmd = @"C:\Windows\System32\pkgmgr.exe";
string cmdargument =
@" start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;
IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;
IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-WindowsAuthentication;
IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;
IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;WAS-WindowsActivationService;
WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;NetFx3";
proc = Process.Start(cmd, cmdargument);
proc.WaitForExit();
proc.Close();
}
catch (Exception objException)
{
// Log the exception
MessageBox.Show("Error message:" + objException.Message);
}
return ActionResult.Success;
}
有人可以建议我如何实现这一目标吗?真诚的感谢!