Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX: Installing Service as LocalService

I am trying to get my application an installer via WiX 3.0. The exact code is:

<File Id="ServiceComponentMain" Name="$(var.myProgramService.TargetFileName)" Source="$(var.myProgramService.TargetPath)" DiskId="1" Vital="yes"/>

<!-- service will need to be installed under Local Service -->
<ServiceInstall
                        Id="MyProgramServiceInstaller"
                        Type="ownProcess"
                        Vital="yes"
                        Name="MyProgramAddon"
                        DisplayName="[removed]"
                        Description="[removed]"
                        Start="auto"
                        Account="LocalService"
                        ErrorControl="ignore"
                        Interactive="no"/>
<ServiceControl Id="StartDDService" Name="MyProgramServiceInstaller" Start="install" Wait="no" />
<ServiceControl Id="StopDDService" Name="MyProgramServiceInstaller" Stop="both" Wait="yes" Remove="uninstall" />

Thing is, for some reason LocalService fails on the "Installing services" step, and if I change it to "LocalSystem" then the installer times out while trying to start the service.

The service starts fine manually and at system startup, and for all intents and purposes works great. I've heard there are issues getting services to work right under LocalService, but Google isnt really helping as everyone's responses have been "got it to work kthx".

Just looking to get this service set up and started during installation, that's all. Any help? Thanks!

like image 244
Tom Corelis Avatar asked Jul 11 '09 20:07

Tom Corelis


People also ask

What is KeyPath in WiX?

The KeyPath for a Component is a single resource that the Windows Installer uses to determine if a Component "exists" on a machine.

How do I create a WiX Windows Installer?

Go to Tools -> WiX Setup Editor. On the left under Root Directory choose InstallFolder. Under Projects to install, choose the project you want to install. In the red area to the right, you'll see a list of files.

Is WiX Installer free?

Download. You can download the WiX toolset for free.


3 Answers

Make sure the services.msc window is closed when you install

like image 131
Markus Avatar answered Dec 01 '22 23:12

Markus


Have you tried ...

NT AUTHORITY\LocalService 

Per this doc ...

... but the name of the account must be NT AUTHORITY\LocalService when you call CreateService, regardless of the locale, or unexpected results can occur.

like image 20
JP Alioto Avatar answered Dec 02 '22 00:12

JP Alioto


reference: ServiceControl Table

The MSI documentation for ServiceControl Table states that the 'Name' is the string name of the service. In your code snipet, your ServiceControl 'Name' is set to the 'ID' for the ServiceInstall and not its 'Name'. So, your ServiceControl elements should read:

<ServiceControl Id="StartDDService" Name="MyProgramAddon" Start="install" Wait="no" />
<ServiceControl Id="StopDDService" Name="MyProgramAddon" Stop="both" Wait="yes" Remove="uninstall" />
like image 21
Roger Stewart Avatar answered Dec 02 '22 00:12

Roger Stewart