【问题标题】:Run a ruby exe file as windows service leads to error运行 ruby​​ exe 文件作为 Windows 服务导致错误
【发布时间】: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.

无法理解我看到此错误的原因,因为我可以直接启动应用程序。我缺少任何参数或我做错了什么?

谢谢大家

【问题讨论】:

标签: ruby windows windows-services


【解决方案1】:

你应该看看this question
查看Win32Utils - Ruby library for MS Windows

来自文档,

请注意,一些库,例如 win32-api 和 win32-service,有 gems 包含预构建的二进制文件,因此不需要编译器 那些库。只需像安装任何其他 gem 一样安装它们。

这些实用程序有一些很好的包装器。 win32-service 就是这样的一颗宝石,可以帮助您实现这一目标。

浏览这些Create a Windows Service with Ruby Part 1Part 2 Steve Johnson 的文章。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-17
    • 2014-04-06
    • 1970-01-01
    相关资源
    最近更新 更多