Search code examples
c#windows-serviceswixinstallationvisual-studio-2015

WIX-Installer ServiceControl "sufficient privileges" error


Visual Studio 2015 RC Wix v3.10.0.1726

I am creating a installer for a windows services. I've tested the service with InstallUtil and it runs fine. Unfortunately I'm having a bit of troubles with wix, here is the exact error -

"Service 'Service Name' failed to start. Verify that you have sufficient privileges to start system services."

Now I've narrowed down the issue to starting the service through WIX. If I forgo the ServiceControl tag and manually start it with services.msc it works fine.

From other questions it appears this error is a general catch error and occurs in a variety of situations. The most popular being if your service relies on assemblies installed to the GAC (Global Assembly Cache) which I am also unclear about. I never implicitly save anything to the GAC and my service simply calls a .cs file I wrote that is included in the project.

Any help would be greatly appreciated!

<Component Id="ProductComponent7">
    <File Source="$(var.ServiceName.TargetPath)" KeyPath="yes" Vital="yes"/>
    <ServiceInstall Id="ServiceName.exe"
                      Account="LocalSystem"
                      Arguments="-start"
                      Type="ownProcess" 
                      Name="ServiceName.exe" 
                      DisplayName="ServiceName Service" 
                      Description="sdfg" 
                      Start="auto" 
                      Interactive="yes"
                      ErrorControl="critical" />
  <ServiceControl Id="ServiceControl" Name="ServiceName" Start="install"  />
        </Component>

I've also tried a variety of different attributes in ServiceControl, I recently removed them all to try to make it as simple as possible.

If anyone has any insight that'd be great!


Solution

  • Correct, it's a generic error. You have to profile your service to understand why it won't start.

    GAC is just one scenario. In that case it's because MSI doesn't publish assemblies to the GAC until after StartServices. A classic race condition that results in a missing dependency and error.

    With the message box still up, run the EXE from the console. Do you get an errors? Do you get any errors in your application log? Find out why the service won't fix, resolve it and try again.