拒绝终止的粘性上架服务



我有一个项目,其中包括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

给出此(预期的)错误:

ERROR Topshelf.Hosts.InstallHost - The MyService service is already installed.

我尝试将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>

也许有点晚了,但我希望别人可能会发现它有用。

当遇到此类问题时,您应该在上架配置中查看Stop方法。确保所有内容都丢弃了。就像关闭各种连接并处理文件手柄一样。这种东西可以使您的服务"粘"。

最新更新