gpt4 book ai didi

windows - 在 Windows 2008 上将 myprogram.exe 作为服务运行时出现问题

转载 作者:可可西里 更新时间:2023-11-01 14:51:41 25 4
gpt4 key购买 nike

MyProgram.exe 用于监听来自管道的请求并使用命令提示符其工作完美但我尝试使用 Windows 服务来处理它但没有成功我已尝试在 Windows Server 2008 Enterprise 上执行以下步骤:

> sc create MyService binPath= "C:\test\MyProgram.exe" DisplayName= "MyProgramService"
>[SC] CreateService SUCCESS

>sc start MyService
[SC] StartService FAILED 1053:

The service did not respond to the start or control request in a timely fashion.

reference

所以我在一个博客上读到我们需要为其创建注册表项,然后我尝试了以下步骤

I found my newly created service under: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MyService

  1. Click the key named MyService (it looks like a folder) from the menu in regedit. Select “edit” and “new” and then select “key.” This will create a new key which you should name “Parameters.” Next, right- click on the key that you just named “Parameters” and select “new” and then “string value.” Name the value “Application.” Double-click the string value and a box will pop up. In the box under “value data”, you need to put the full path to the Dropbox. In my case, the path was: C:\test\MyProgram.exe\MyProgram.exe

  2. Start your new service. Navigate to the services list in the control panel‘s administrative tools or simply type services.msc in the run box. Find DropBox in the list and start it. New services should be set to start automatically, but feel free to check it to be sure.

但是服务启动了几秒钟就终止了。当我从 services.msc 手动启动服务时出现错误

StartService FAILED 1053:

The service did not respond to the start or control request in a timely fashion.

不确定为什么有人在它上面工作,请指导使其成为服务。

最佳答案

您不能将任何 EXE 作为 Windows 服务运行。您必须有一个 exe,它了解成为服务的意义,并且能够与 Windows 服务控制管理器进行适当的通信。

请参阅 Microsoft 文档,以 http://msdn.microsoft.com/en-us/library/windows/desktop/ms686953(v=vs.85).aspx 开头.

关于windows - 在 Windows 2008 上将 myprogram.exe 作为服务运行时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12560727/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com