我有一个项目,其中包含一个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.我试着把最新的版本更新到最新版本。由于另一个奇怪的错误,在部署服务器上手动卸载和终止服务也不起作用。
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.我就是搞不懂为什么会这样。我尝试添加更多的错误日志记录,但什么也没有出现。
以前有人有过这个吗?你知道如何让这个“粘性”服务在卸载后停止运行吗?
谢谢
发布于 2017-07-03 16:19:35
嗨,你有没有试过用windows命令删除这个服务?
打开命令提示符并输入
sc delete <service-name>发布于 2019-01-30 17:43:44
可能有点晚了,但我希望其他人会发现它是有用的。
当遇到这样的问题时,你应该在你的Topshelf配置中研究一下Stop方法。确保所有的东西都放在里面。就像关闭各种连接并释放文件句柄一样。这种东西会让你的服务变得“粘性”。
https://stackoverflow.com/questions/42624538
复制相似问题