Wix Installer:验证您是否具有足够的权限来安装系统服务

时间:2016-03-14 09:10:38

标签: wix

我已经使用Installutil.exe手动安装了Windows服务,现在最重要的是我现在要使用wix进行安装。 我正在尝试使用WIX安装Windows服务。 我的目的是首先停止服务,安装服务然后启动服务。

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
      <Product Id="*" Name="GPAT-PricingInactivateService" Language="1033" Version="1.0.0.0" Manufacturer="American Express" UpgradeCode="6b4cf27d-6504-4e24-803e-d26491b21b3d">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />


        <Upgrade Id="6b4cf27d-6504-4e24-803e-d26491b21b3d">
          <UpgradeVersion Minimum="0.0.0.0"
                          IncludeMinimum="yes"
                          OnlyDetect="no"
                          Maximum="1.0.0.0"
                          IncludeMaximum="yes"
                          Property="PREVIOUSFOUND" />
        </Upgrade>


        <InstallExecuteSequence>
          <RemoveExistingProducts After="InstallValidate"/>
        </InstallExecuteSequence>

        <Feature Id="ProductFeature" Title="GPAT-PricingInactivateService" Level="1">
          <ComponentGroupRef Id="ServiceComponents" />
        </Feature>

        <Media Id="1" Cabinet="Components.cab" EmbedCab="yes" />

        <Property Id="TARGETDIR">C:\Test\</Property>

      </Product>

      <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
          <Directory Id="INSTALLFOLDER" Name="GPATPriceInactiveService"/>
        </Directory>
      </Fragment>

      <Fragment>
        <ComponentGroup Id="ServiceComponents">
                <Component Id="Axp.Gcpt.Gpat.Worker.Library" Directory="INSTALLFOLDER" Guid="{E1810FA9-5620-4739-9FE2-2726CC2CA6F4}">
            <File Id="FileService" Name="Axp.Gcpt.Gpat.Worker.exe" Source="$(var.Axp.Gcpt.Gpat.Worker.TargetDir)\Axp.Gcpt.Gpat.Worker.exe" KeyPath='yes' />


            <ServiceInstall Id="GPATService" Type="ownProcess" Name="Axp.Gcpt.Gpat.Worker" DisplayName="Axp.Gcpt.Gpat.Worker"
                    Description="Axp.Gcpt.Gpat.Worker description" Start="auto"  Account="LocalSystem" ErrorControl="normal" Interactive="yes" Vital="yes" >
 <ServiceControl Id="GPATServiceStart"  Name="Axp.Gcpt.Gpat.Worker" Stop="both" Start="both"  Wait="yes" />
      </Component>

2 个答案:

答案 0 :(得分:0)

不要指定

  

帐户=&#34;本地系统&#34;

如果您希望使用LocalSystem-Account,请在ServiceInstall块中

答案 1 :(得分:0)

您可以指定Windows用户。

    <u:User Id="UpdateUserLogonAsService" UpdateIfExists="yes" CreateUser="no" Name="[USERNAME]" LogonAsService="yes" RemoveOnUninstall="no"/>
            <ServiceInstall 
                  Id="GPATService" 
                  Type="ownProcess" 
                  Name="Axp.Gcpt.Gpat.Worker" 
                  DisplayName="Axp.Gcpt.Gpat.Worker"
                  Description="Axp.Gcpt.Gpat.Worker description"
                  Start="auto"
                  ErrorControl="normal"
                  Account='[USERNAME]'
                  Password='[PASSWORD]'/>