Wix Windows Service – Start on install

So I was building a wix setup project for a windows service and kept running into a wall while getting the service to start after a successful install. It kept giving me an error “Verify that you have sufficient privileges to start system services”. I searched through nearly 50 articles that led me on a wild goose chase of the issue being related to actual permissions, dual service control tags, the wait attribute and hacks inside the service installer code behind. To actual solution was ridiculously simple, the error was just too obscure to identify the root cause.

My wxs file had the following contents

<ServiceInstall
  Id="ServiceInstaller"
  Type="ownProcess"
  Vital="yes"
  Name="Ninjacrab Awesome Service"
  DisplayName="Ninjacrab Awesome Service"
  Description="The super awesome service"
  Start="auto"
  Account="LocalSystem"
  ErrorControl="ignore"
  Interactive="no"
  />
<ServiceControl
  Id="StartService"
  Name="NinjacrabAwesomeService"
  Start="install"
  Stop="both"
  Remove="uninstall"
  Wait="yes"
  />

Not sure how it caught my eye, but I noticed the name was different

<ServiceInstall
  Id="ServiceInstaller"
  Type="ownProcess"
  Vital="yes"
  Name="Ninjacrab Awesome Service"
  DisplayName="Ninjacrab Awesome Service"
  Description="The super awesome service"
  Start="auto"
  Account="LocalSystem"
  ErrorControl="ignore"
  Interactive="no"
  />
<ServiceControl
  Id="StartService"
  Name="Ninjacrab Awesome Service"
  Start="install"
  Stop="both"
  Remove="uninstall"
  Wait="yes"
  />

Sure enough this fixed the problem and I went on my merry way.


Posted

in

by

Tags:

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.