我想在本地机器上停止Windows服务的服务(该服务是Topshelf.Host
,如果该事项)使用此代码:的ServiceController似乎无法停止
serviceController.Stop();
serviceController.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
timeout
设为1小时,但服务从未实际停止。奇怪的是,从服务MMC管理单元中,我首先看到它处于“停止”状态,但过了一段时间,它又恢复为“已启动”。但是,当我尝试手动停止它时,发生错误:
Windows could not stop the Topshelf.Host service on Local Computer.
Error 1061: The service cannot accept control messages at this time.
我在这里丢失了什么吗?
谢谢你,这是一个好 – user584018 2017-06-08 11:03:45
使用任务管理器作为管理员,我可以不杀该服务,重启没有帮助。这是为我工作的方法。 – ChrisG 2017-08-18 11:36:17
为我工作。不要忘记以管理员身份运行PowerShell。 – Aaron 2017-10-13 23:03:56