My project currently consists of a Windows service that fetches data in one thread, and uses another thread to periodically index the fetched data into Solr.
This is where the frustration comes in. I have been debugging the Windows service code as I've been updating the database, or Solr schema, etc. I'll find something that I want to change in the service code, so I'll uninstall the service, recompile the code, and re-install the service. Occasionally, when I attempt to uninstall the service, Windows will display a message stating that the service is marked for deletion.
The specified service has been marked for deletionI won't be able to install the service until the service is uninstalled, and Windows won't uninstall the service until the machine is rebooted. I tried the "sc delete <service name>" method for deleting a service, and I get the same message about the service being marked for deletion. I ended up rebooting, and the service was gone when Windows restarted.
I did a search for "remove service without rebooting" and I found this blog post. The post says to uninstall the service with the services window closed. I'll definitely follow the suggested advice the next time I have this issue.
Has anyone else experienced this problem and found a different way to avoid the problem?
Update: Following the advice from the blog post mentioned above definitely works. I haven't had an issue as long as I was making sure that the services window was closed when uninstalling. Perhaps it is coincidence, and I might as well have thrown chicken bones at the computer, but I followed the advice and I haven't seen the problem again.
Update (2013-01-09): I've now seen the "marked for deletion" issue at work while services are being deployed. The services window is most likely not opened on the target machine. My only guess is that there are multiple ways for Windows to decide that the service is in a state of being used, so it decides to mark the service as being marked for deletion to prevent any additional processes from trying to query the service for its state. For now I will just try to make sure the services window is closed, and suffer through reboots when the service refuses to be uninstalled.
No comments:
Post a Comment