Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing/Uninstalling Services in Windows 7: "Error 1001. The specified service has been marked for deletion"

I am currently developing a Windows Service in .NET 4.0, Visual Studio 2010, Windows 7-32bit. I have an installer project that does the installation for me. When I install the service, uninstall it, and try to install again, I get the following error:

Error 1001. The specified service has been marked for deletion

In Windows XP, the problem was that the Services.msc was open. Closing this window would fix this problem.

However, with Windows 7, the only way I can fix this is to restart. I tried closing all my programs, but the problem still persists.

Does anyone know how to fix this without restarting?

Edit

I have not seen this problem since I stopped using the MSI installer, I use sc.exe instead, to install the services manually. I think this problem might be related to the combination of Visual Studio 2010 and MSI Installer Projects. However, I still don't know what was the culprit of this problem. It turns out that Process Explorer was the culprit.

like image 404
Mas Avatar asked Nov 22 '10 13:11

Mas


People also ask

Why service is marked for deletion?

If you have any Services MMCs running locally on the computer in question, or running remotely on another computer, but connected to the server your application is installed on – close it. The Services MMC is the most common reason behind the “specified service has been marked for deletion” error message.


4 Answers

I was facing the same problem on Windows 7 Ultimate edition. Installing the service after closing the Services.msc window solved my problem.

like image 179
Ramya Avatar answered Sep 25 '22 08:09

Ramya


Short Answer

  • Close Services.msc
  • Close Process Explorer

Long Answer

After running into this problem again, I went to task manager and started shutting down processes. I eventually found the culprit, it was an internal corporate application used for managing software distribution. I shut it down, and the services were finally gone.

Update

I also found that sometimes Process Explorer needs to be closed for deleted services to disappear.

like image 32
Mas Avatar answered Sep 24 '22 08:09

Mas


Have you considered using a different MSI authoring tool such as Windows Installer XML? The advantage is it doesn't hide Windows Installer's underlying ServiceInstall / ServiceControl panels saving you from the pain of reinventing the wheel with fragile out of process InstallUtil code.

like image 44
Christopher Painter Avatar answered Sep 24 '22 08:09

Christopher Painter


I just solved this problem myself, in Windows 7.

FWIW, turns out you can go to the "Services" tab, right-click on the offending service, choose "Go To Process", and kill as required.

like image 21
Ben Avatar answered Sep 24 '22 08:09

Ben