Windows services 拒绝终止的粘性topshelf服务

Windows services 拒绝终止的粘性topshelf服务,windows-services,topshelf,Windows Services,Topshelf,我有一个包含topshelf服务的项目,部署脚本将在服务器上卸载并重新安装新版本 这项措施在很长一段时间内效果良好,直到上周,由于未知原因,它开始出现行为不端的情况 现在发生的是命令: D:/Deploy/current/net40/MyService.exe uninstall 打印这些结果: The uninstall is beginning. 2017-03-06T11:21:07 [1] INFO Topshelf.Runtime.Windows.HostInstaller - U

我有一个包含topshelf服务的项目,部署脚本将在服务器上卸载并重新安装新版本

这项措施在很长一段时间内效果良好,直到上周,由于未知原因,它开始出现行为不端的情况

现在发生的是命令:

D:/Deploy/current/net40/MyService.exe uninstall
打印这些结果:

The uninstall is beginning.
2017-03-06T11:21:07 [1] INFO  Topshelf.Runtime.Windows.HostInstaller - Uninstalling MyService service
Removing EventLog source MyService.
Service MyService is being removed from the system...
Service MyService was successfully removed from the system.
Attempt to stop service Halcyon.
The uninstall has completed.
但MyService.exe仍在TaskManager中运行

结果

此命令:

D:/Deploy/current/net40/MyService.exe install --manual
给出此(预期)错误:

我尝试将Topshelf更新到最新版本。 由于另一个奇怪的错误,在部署服务器上手动卸载和终止服务也不起作用

Beginning the Install phase of the installation.
2017-03-06T11:40:08 [1] INFO  Topshelf.Runtime.Windows.HostInstaller - Installing MyService service
Installing service MyService...
Service MyService has been successfully installed.

The Install phase completed successfully, and the Commit phase is beginning.

The Commit phase completed successfully.

The transacted install has completed.
INFO  MyService.Program - Exiting Main() - exitCode:Ok
INFO  Dozo::Applications::Topshelf - Starting MyService
INFO  Dozo::Applications::Topshelf - Changing MyService to start automatically
INFO  Dozo::Dozo - sc config "MyService" start= auto
[SC] ChangeServiceConfig SUCCESS
INFO Dozo::Applications::Topshelf - Starting MyService
INFO  Dozo::Dozo - net start "MyService"
The MyService service is starting........
The MyService service could not be started.
我就是不明白为什么会这样。 我尝试添加更多的错误日志记录,但没有结果

以前有人吃过这个吗?有没有办法让这个“粘性”服务在卸载后停止运行


谢谢

您好,您是否尝试使用windows命令删除该服务

打开命令提示符并输入

sc delete <service-name>
sc删除

可能有点晚,但我希望其他人会觉得它有用

当出现类似问题时,您应该查看Topshelf配置中的
Stop
方法。确保所有东西都放在里面。与此类似,关闭各种连接并释放文件句柄。这种东西会让你的服务变得“粘乎乎的”

sc delete <service-name>