WiX Windows服务安装失败

时间:2015-04-27 15:04:58

标签: windows service wix

我正在尝试使用WiX进行服务安装。 这会尝试安装我的服务但最终会失败。你有什么主意吗? 我的服务应该使用本地用户帐户。此帐户已添加为"可以运行窗口服务的用户"。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
 xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="MySvcSetup" Language="1033" Version="1.0.0.0" Manufacturer="CMPY" UpgradeCode="aae1a2bc-2ae0-409b-adc4-77cc7fc06a87">
    <Package InstallerVersion="200" Compressed="yes" AdminImage="yes" InstallScope="perMachine" InstallPrivileges="elevated" />    
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />
    <Feature Id="ProductFeature" Title="MySvcSetup" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
</Product>
<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
    <Directory Id="SLBFOLDER" Name="CMPY">
              <Directory Id="INSTALLFOLDER" Name="My Service" />
    </Directory>
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
         <Component Id="ProductComponent" Guid="{15554AD5-F373-453A-88B9-BE1112A6C804}"> 
             <!--TODO: Insert files, registry keys, and other resources here.-->
     <File Id="MySvc.exe" Name="MySvc.exe" Source="..\..\..\..\Services\xxx\bin\Release\MySvc.exe" Vital="yes" KeyPath="yes" DiskId="1"/>
     <File Id="Encryption.dll" Name="Encryption.dll" Source="..\..\..\..\Services\xxx\bin\Release\Encryption.dll" Vital="yes" KeyPath="no" DiskId="1"/>
     <ServiceInstall
       Id="MySvc.exe"
       Type="ownProcess"
       Vital="yes"
       Name="MySvc"
       DisplayName="My service"
       Description="...."
       Start="auto"
       Account=".\MySvcUser"
       Password="CN9P4CvTRo"
       ErrorControl="ignore"
       Interactive="no">
       <util:PermissionEx
                            ChangePermission="yes"
                            Delete="yes"
                            GenericAll="yes"
                            ReadPermission="yes"
                            ServiceChangeConfig="yes"
                            ServiceEnumerateDependents="yes"
                            ServiceInterrogate="yes"
                            ServicePauseContinue="yes"
                            ServiceQueryConfig="yes"
                            ServiceQueryStatus="yes"
                            ServiceStart="yes"
                            ServiceStop="yes"
                    ServiceUserDefinedControl="yes"
                            Synchronize="yes"
                            TakeOwnership="no"
                    User=".\MySvcUser"
                            />
       <util:ServiceConfig
            FirstFailureActionType="restart"
            SecondFailureActionType="restart"
            ThirdFailureActionType="restart"
            RestartServiceDelayInSeconds="60"
            ResetPeriodInDays="0" />
     </ServiceInstall>
     <ServiceControl Id="MySvc.exe" Start="install" Stop="both" Remove="uninstall" Name="GTCollector" Wait="yes" />
         </Component> 
    </ComponentGroup>
</Fragment>

1 个答案:

答案 0 :(得分:0)

尝试

Account =“ LocalSystem”

代替

Account =“。\ MySvcUser”

相关问题