2011-02-03 76 views
0

我正在使用以下自定义操作来安装使用.msi的IIS 7(如果它尚未安装在目标系统上)。我遇到了错误,安装失败。我在我的msi中使用了相当多的CA,并且一切正常。但是对于这一个,我无法弄清楚问题可能出在哪里?直接在cmd提示符下执行这个命令是完美的。 任何人都可以提供任何建议,我做错了什么?请指点使用pkgmgr安装IIS 7

针对性的操作系统:Windows 7 -32位

CustomAction代码:

<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> 

从我的日志文件错误:

Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: InstallIISCA, location: [SystemFolder], command: 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

的更多信息:我使用下面的代码检查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]:跳过操作:InstallIISCA(条件为false)?这怎么可能。

也创造了C#,但它也与Windows软件包管理器错误,无法替代的CA:操作失败

[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; 
    } 

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

+0

那么我编辑清理问题的一些,但我不知道如何处理问题标题。让您的标题对社区有意义。 “Kim My starred items”没有意义。 – Amy 2011-02-03 23:07:03

+0

对不起yodaj007。我输入了“使用pkgmgr安装IIS 7 ”作为标题。不知道它是如何变成这样愚蠢的东西。感谢您提醒我注意。 – Kim 2011-02-03 23:38:38

回答

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) /> 
2

不要使用 “开始/ w的PKGMGR” 初始化 “字符串cmdargument” 时,让你的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";