Windows Service – Marked For Deletion

Sharing is Caring

Windows Services,especially managed .NET ones , can be extremely difficult to deploy if not done correct initially. Errors, of course, can also be very difficult to diagnose if theres a problem immediately after the server starts.

Occasionally, as a developer you need to uninstall the service whether it be through sc delete, or installutil /u . Sometimes, the service isn’t uninstalled immediately and still exists in the server management console. (services.msc) after the uninstall is done.

To reduce the need to restart the machine, we should do the following:

  1. Stop the service.
  2. Close services.msc
  3. Uninstall service.

Why A Restart Is Required

  • Windows 2000 machines, in my experience, have almost always had to have a restart.
  • If the service creates many worker threads, sometimes these threads will also hang around resulting in a restart being required.
  • This is done if CanStop = false in your service code.Windows knows this service shouldn’t be stopped and it will only mark it for deletion but will not delete it right away.

Hope this helps!

Sharing is Caring
, , ,