Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't my service deleted on uninstall? (WIX)

Tags:

wix

Even after a reboot, the service is still there, even though the executable file is gone. I'm using WIX version 3.0.5419.0

<Component Id="IdiomServer.exe" Guid="7a751e1e-5e9e-41d2-be60-dc905ab1ccad">
  <File Id="IdiomServer.exe" Source="$(var.IdiomServer.TargetDir)IdiomServer.exe" KeyPath="yes" />
  <ServiceInstall Id="IdiomServer_Service" Name="IdiomServer 4.0" Account="LocalSystem" Description="Idiom Repository Server" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" />
  <ServiceControl Id="IdiomServer_Service" Name="IdiomServer 4.0" Remove="uninstall" Stop="uninstall" Wait="yes" />
</Component>

Installing the Windows Service works fine. Uninstalling it appears to do nothing. Section of the log file from the uninstall:

MSI (s) (D8:5C) [09:43:58:033]: Doing action: StopServices
MSI (s) (D8:5C) [09:43:58:033]: Note: 1: 2205 2:  3: ActionText 
Action start 9:43:58: StopServices.
Action ended 9:43:58: StopServices. Return value 1.
MSI (s) (D8:5C) [09:43:58:033]: Doing action: DeleteServices
MSI (s) (D8:5C) [09:43:58:033]: Note: 1: 2205 2:  3: ActionText 
Action start 9:43:58: DeleteServices.
Action ended 9:43:58: DeleteServices. Return value 1.

Any help would be much appreciated.

like image 764
Rupert Morrish Avatar asked Sep 15 '09 22:09

Rupert Morrish


4 Answers

I have an almost identical installer that works fine. The only differences are that my ServiceControl element has a different Id to the ServiceInstall element, and a 'Start="install"' property too.

I suspect your problem is either the Id of the ServiceControl element, or you have a stray service hanging around.

Try the following:

  • Change the ServiceControl Id to "IdiomServer_ServiceControl"
  • Change the Name in both Service elements to "Foobar" and check if the Foobar service is both installed and uninstalled. If that works, you may just need to manually delete the stray IdiomServer entry with the "sc" command.
like image 74
Martin Avatar answered Nov 16 '22 03:11

Martin


I also had a similar problem. In my case, I just had to make sure that both ServiceInstall and ServiceControl's "Name" attributes are the same, and the problem went away.

like image 22
Jazon Avatar answered Nov 16 '22 05:11

Jazon


I had the same issue of the service not deleting. I had copied the Component, Service Install and ServiceControl elements from another project without changing the Guid or IDs. After updating with new GUID and IDs the service now deletes.

like image 22
StevenM Avatar answered Nov 16 '22 03:11

StevenM


I had a similar problem to that described by Rupert. In my case the service was not uninstalled from the Service Control Manager and the .exe was also left behind. After much digging the answer was pretty straightforward. In the containing <Component> element the GUID attribute was set to "" (i.e. empty string). Replacing with <Component ... GUID="56CD2588-B976-4198-B815-FAB7E1E57CD7" > resolved the problem

like image 24
prairiehat Avatar answered Nov 16 '22 03:11

prairiehat