Windows Service: Specified Service Already Exists

I keep getting this error when trying to install this windows service, written in C#. I have uninstalled and installed this service many times, and only this last time has it seemed to break.

Looking in the Admin Settings --> Service window, I still see my service. It can't start and I see no way to remove it otherwise.

What happened, and how can I fix this I have found suggestions on using Win32API to test for and remove the service, in the overridden Installation class for the Deployment package I'm using, but cannot find any such methods described under Microsoft.Win32.




Answer this question

Windows Service: Specified Service Already Exists

  • vsnk

    I have restarted; unfortunately, it didn't help.

    After some searching, I eventually found what solved the problem:
    http://pinvoke.net/default.aspx/advapi32.DeleteService

    This code has removed whatever chunks were left over--I just had to recompile a few DLL's to get the actual Deployment package accurately updated, and all was good.



  • Erik Poirier

    Create a project with this code in it:

    http://aspzone.com/blogs/john/archive/2006/08/18/1921.aspx


  • ertobias

    have you tried rebooting the machine

    Sometimes when installing/uninstallng a service many times, Windows instead of uninstalling it it will "mark it as deletion" and you won't be able to uninstall or starting it after a machine reboot.



  • Windows Service: Specified Service Already Exists