安装/卸载服务在Windows 7:"错误1001指定的服务已被标记为删除"已被、标记、错误、Windows

2023-09-04 01:38:29 作者:日久不生情

我目前正在开发在.NET 4.0中,Visual Studio 2010中的Windows 7-32bit Windows服务。我有一个安装项目,该项目确实安装了我。当我安装服务,卸载它,并尝试重新安装,我得到以下错误:

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:

错误1001指定的服务已被标记为删除

Error 1001. The specified service has been marked for deletion

在Windows XP中,问题是,SERVICES.MSC是开着的。关闭此窗口将解决这个问题。

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

不过,与Windows 7,可以解决此问题是重新启动的唯一途径。我试图关闭所有的程序,但问题仍然存在。

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?

修改

我还没有看到这个问题,因为我停止使用MSI安装程序,我使用SC.exe相反,手动安装服务。 我觉得这个问题可能与Visual Studio 2010和MSI安装程序项目的组合。不过,我还是不知道什么是这个问题的罪魁祸首。 原来,进程管理器是罪魁祸首。

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.

推荐答案

简答

关闭SERVICES.MSC 在关闭的Process Explorer

长的答案

再次运行到这个问题后,我去了任务管理器,并开始关闭进程。我终于找到了罪魁祸首,它是用于管理软件分发企业内部的应用程序。我将其关闭,并在服务终于消失了。

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.

更新的

我还发现,有时候进程浏览器需要被关闭删除服务消失。

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