Link to home
Start Free TrialLog in
Avatar of Jens Fiederer
Jens FiedererFlag for United States of America

asked on

Setup Project not Stopping/Deleting a Service during Uninstall

I have implemented a service that handles WCF requests.

I have created a setup project for that  (VS 2005 setup project)

It installs (apparently) fine, and I have a custom action implemented that will start the service after the install completes (this part works).

However, during uninstall, even on a machine that has had this installed only once, the service is not stopped, and not deleted (to check, I also did this with a sample "Hello world" type service, and THAT one was stopped fine during uninstall.  The uninstall completes reporting success.

Here is what I believe to be the lines in the log where the stop/delete is attempted:
MSI (s) (60:9C) [09:49:29:798]: Doing action: StopServices
Action 9:49:29: StopServices. Stopping services
Action start 9:49:29: StopServices.
MSI (s) (60:9C) [09:49:29:798]: Note: 1: 2262 2: ServiceControl 3: -2147287038
Action ended 9:49:29: StopServices. Return value 1.
MSI (s) (60:9C) [09:49:29:798]: Doing action: DeleteServices
Action 9:49:29: DeleteServices. Deleting services
Action start 9:49:29: DeleteServices.
MSI (s) (60:9C) [09:49:29:798]: Note: 1: 2262 2: ServiceControl 3: -2147287038
Action ended 9:49:29: DeleteServices. Return value 1.
Avatar of surajguptha
surajguptha
Flag of United States of America image

Can you manually stop the service?
ASKER CERTIFIED SOLUTION
Avatar of surajguptha
surajguptha
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jens Fiederer

ASKER

Yes, manually stopping the service with
     net stop servicename
works fine.
Manually deleting it with
sc delete servicename
ALSO works fine.

I will try installutil to see if I get any interesting messages.
yep... please keep us posted...
Well, I had to try installutil BEFORE the uninstall.  I did get some messages (from a failed attempt to stop the service within my CustomActions that I had not remembered to remove: "System.ComponentModel.Win32Exception: The specified service does not exist as an installed service"), but removing that extraneous code removed the error messages without solving the problem.

Now, using installutil -u stops and deletes the service (without removing the code)

Using setup removes the code without stopping or deleting the service.
without removing the code ??
Right - I believe that is standard behavior, it only triggers the installer classes in the target.  After doing an
     installutil -u <path>
I can run setup (with removal) and get rid of the actual code.
Installutil -u would remove all the DLL's that are installed as a part of the service. It wouldnt remove the SOURCE CODE
I am not talking about source, I mean the exe/dll.

Even doing this on the Example program (which works fine with setup), doing an installutil -u does not remove the .exe.

yep the uninstall would merely remove the services from the windows services list. The files would continue to stay there. so you will have to installutil -u and then remove the files...
Right, that is what I was saying.

So back to the question:  why I my setup project not achieving this?
Do you have any specific custom action that you are using to uninstall it?
Custom actions for all four items are set to primary output from the Service (except commit, which also calls an executable to do the
net start servicename
).


Nothing special was written for the uninstall, I am counting on what MS included with the generated service installer (which works with the sample service).
It has worked for me too. There should be some thing different you should be doing..... Lemme think
I don't think it really matters anymore - apparently SOMETHING is a bit messed up with the setup project, but I'll never know what.


I made a "copy: of the original setup project for QA purposes (created a new one from scratch with the same structure, it only takes about 5 or 6 operations).  THAT one worked perfectly!

I then made another one as an alternate, and that one worked perfectly as well, so I am going to use THAT and abandon the original (which still does not work for some mysterious reason).

Your suggestion to use installutil really DID help my diagnostic progress, thank you!