How to remove a service when installation is incomplete and the service is 'marked for deletion'

StackOverflow https://stackoverflow.com/questions/21113523

  •  28-09-2022
  •  | 
  •  

Question

Problem with developing and testing a service installer: result, the service is 'installed' and appears as such in the Services tool, but does not start and I cannot 'uninstall' it in the conventional way (files missing).

So I used the SC tool to delete the service. Now if I try to reinstall it, the installer reports that the service is 'marked for deletion'.

How can I recover from this?

TIA

Was it helpful?

Solution

Restart machine and service status should be cleared. It is an old inconvenience I remember from .NET 2.0 and Windows XP times, that seems still not to be resolved.

OTHER TIPS

It's nearly always an issue with some code somewhere on the system that has a handle open to the service and has leaked it. For example, the handle returned from the Win32 OpenService call, or somebody with a ServiceController class shutting it down and not doing a Close or Dispose. There used to be a bug in the services applet that caused this issue for this reason.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top