Reputation: 2088
I'm writing a small service in C# and I've installed it and uninstalled it a couple of times and all of a sudden it won't install again. I tried to uninstall it and it says there is nothing to uninstall, but when I install it again I get the following message:
Error 1001: The specified service already exists
Now, I've tried the following solutions:
Close the service manager (as an open service manager may hold a handle to it)
Tried to find it with SC QUERY and delete is using SC DELETE (according to Service already exists (when it clearly doesn't))
Tried to remove it in regedit (doesn't exist there)
I've correctly added the project output to Custom Actions (install, commit, rollback, uninstall)
Restarted the computer (!)
I'm running out of ideas. There is absolutely no proof that the service is installed on my computer and even though thousands of developers seems to have had this problem (and I've even had it myself previously) I've never heard of a situation where none of the standard solutions actually works.
What could I have missed?
EDIT
I've been into regedit and I tried again to find my service, but this time I exported the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ section and searched it. I can find my service in the dump under:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService
But then I go there in the regedit view, it's not there. Any suggestions? How did I screw that up :?
RE-EDIT
Disregard edit, the service only shows in regedit while the install i showing the error message, but that's event weirder, the service is installed, then breaks and rollbacks...
Upvotes: 2
Views: 11848
Reputation: 3015
As a temporary solution, you can change the name of the service slightly ( e.g. add or remove one or two chars from the service_name) but keep the display_name the same.
Upvotes: 2
Reputation: 152
I had a similar issue to this (the service was in stopped state and then deleted by an overzealous disk space tidier) and to solve it I copied my new service to the same location as marked in the "Path to Executable" box, and then started the service.
No issues so far.
Upvotes: 0
Reputation: 46018
I would suggest looking and Sysinternals Process Monitor activity and going backwards trying to find what happened before the error was reported. You might be able to see that for example a certain reg key was accessed.
Upvotes: 1