【发布时间】:2015-09-16 18:29:43
【问题描述】:
我被这个问题困扰了好几天,任何帮助都将不胜感激。
有一个名为app.exe 的ruby 文件,它位于"C:\MyApp\app.exe"。这是一个创建系统托盘图标的 Windows 应用程序。当我直接单击app.exe 时,效果很好。但我想把它做成一个 Windows 服务,这样它就一直在系统托盘上(在系统启动给所有用户之后)。
所以我了解到,Windows 中的sc 命令有一些命令行参数,可用于创建服务。我正在这样做:
sc create "testservice" binpath= "C:\Prevas\MyApp\app.exe" displayname= "Test Service"
当我开始时:
sc start "testservice"
当我这样做时,我得到一个错误:
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
无法理解我看到此错误的原因,因为我可以直接启动应用程序。我缺少任何参数或我做错了什么?
谢谢大家
【问题讨论】:
-
SC won't do the trick by itself;你需要一个服务包装器。
标签: ruby windows windows-services