Reputation: 1729
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!
Upvotes: 4
Views: 4361
Reputation: 989
For me, the error was due to that Name
attribute in the ServiceInstall
tag was having a different name value from the one specified in the ServiceBase child class
InitializeComponent()
method.
Code updates:
In Product.wxs:
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="MyWindowsService"
DisplayName="$(var.ServiceDisplayName)"
Description="$(var.ServiceDiscription)"
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
In ServiceBase child class:
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "MyWindowsService";
}
Upvotes: 0
Reputation: 20780
The issue appears to be that you've installed a service called ServiceName.exe and you're trying to start a serice called just ServiceName. The Name values need to match.
Upvotes: 4
Reputation: 55571
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.
Upvotes: 0