0

如果目标系统上尚未安装 .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;
    }

有人可以建议我如何实现这一目标吗?真诚的感谢!

4

2 回答 2

3

我想到了!!

发布解决方案以防其他人需要相同的解决方案:-)

<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 .....(all remaining parameters) />
于 2011-02-04T21:51:36.093 回答
2

初始化“string cmdargument”时不要使用“start /w pkgmgr”,这样您的 cmdargument 将是:

cmdargument = @" /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";
于 2012-10-02T16:07:52.120 回答