如何解决“指定的服务已被标记为删除”错误

本文翻译自:How to solve “The specified service has been marked for deletion” error

I try to remove a Windows Service with sc delete <service name> , and encounter the following error: 我尝试使用sc delete <service name> Windows服务,并遇到以下错误:

[SC] DeleteService FAILED 1072: [SC] DeleteService失败1072:

The specified service has been marked for deletion. 指定的服务已标记为删除。

What I've already done: 我已经完成的工作:

The problem persists. 问题仍然存在。

What is the next step? 你下一步怎么做?


#1楼

参考:https://stackoom.com/question/1OH70/如何解决-指定的服务已被标记为删除-错误


#2楼

There may be several causes which lead to the service being stuck in “marked for deletion”. 可能有多种原因导致服务卡在“标记为删除”中。

  1. SysInternals' Process Explorer is opened . SysInternals的Process Explorer打开 Closing it should lead to automatic removal of the service. 关闭它会导致服务自动删除。

  2. Task Manager is opened . 任务管理器已打开

  3. Microsoft Management Console (MMC) is opened . Microsoft管理控制台(MMC)已打开 To ensure all instances are closed, run taskkill /F /IM mmc.exe . 要确保关闭所有实例,请运行taskkill /F /IM mmc.exe

  4. Services console is opened . 服务控制台已打开 This is the same as the previous point, since Services console is hosted by MMC. 这与上一点相同,因为Services控制台由MMC托管。

  5. Event Viewer is opened . 事件查看器已打开 Again, this is the same as the third point. 同样,这与第三点相同。

  6. The key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\{service name} exists . 密钥HKEY_LOCAL_MACHINE \\ SYSTEM \\ CurrentControlSet \\ Services \\ {服务名称}存在

  7. Someone else is logged into the server and has one of the previously mentioned applications opened. 其他人登录到服务器 ,并打开了前面提到的应用程序之一。

  8. An instance of Visual Studio used to debug the service is open. 用于调试服务的Visual Studio实例已打开。


#3楼

This can also be caused by leaving the Services console open. 这也可能是由于打开服务控制台导致的。 Windows won't actually delete the service until it is closed. 在关闭服务之前,Windows实际上不会删除该服务。


#4楼

In my case, it was caused by unhandled exception while creating eventLog source. 就我而言,这是由创建eventLog源时未处理的异常引起的。 Use try catch to pin point the cause. 使用try catch查明原因。


#5楼

发现了另一项要检查的内容-在任务管理器中查找-如果其他用户已连接到此框,即使他们已“断开连接”,您也必须实际注销他们才能最终删除该服务。


#6楼

Deleting registry keys as suggested above got my service stuck in the stopping state. 如上所述删除注册表项会使我的服务陷入停止状态。 The following procedure worked for me: 以下过程对我有用:

open task manager > select services tab > select the service > right click and select "go to process" > right click on the process and select End process 打开任务管理器>选择服务选项卡>选择服务>右键单击并选择“转到流程”>右键单击该流程,然后选择“结束流程”

Service should be gone after that 在那之后服务应该消失了

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值