Maffelu
Maffelu

Reputation: 2088

Windows service won't install: The specified service already exists

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:

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

Answers (3)

Marcel Valdez Orozco
Marcel Valdez Orozco

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

Graham Cuthbert
Graham Cuthbert

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

Jakub Konecki
Jakub Konecki

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

Related Questions