简体   繁体   中英

WiX Windows service install failure

I am trying to use WiX for my service installation. This tries to install my service but eventually fails. Do you have any idea? My service should use a local user account. This account was added as "users which can run window services".

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

Try

Account="LocalSystem"

instead of

Account=".\\MySvcUser"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM