2

我在 node-js 平台上有一个应用程序安装程序,目前正在使用 Inno Setup 和 NSSM 开发一个安装程序(该应用程序应该作为服务运行)。

问题是当 NSSM 尝试注册服务时(设备是在平板电脑上运行的 Windows 8.1 32 位企业版),NSSM 失败,退出代码为 5。

我找不到比拒绝访问更有用的东西并且在这件事上没有任何帮助。尝试了很多东西,比如更改文件夹、名称、用户,每次都失败了。

Inno 脚本如下所示:

; Add System Service Filename: "{app}\{#NSSM}";
Parameters: "install {#MyAppShortName} {app}\winstart-server.bat";
Flags: runhidden runascurrentuser;
Filename: "{app}\{#NSSM}";
Parameters: "set {#MyAppShortName} AppStdin {app}\{#MyAppShortName}.log";
Flags: runhidden runascurrentuser; 
Filename: "{app}\{#NSSM}";
Parameters: "set {#MyAppShortName} AppStdout {app}\{#MyAppShortName}.log";
Flags: runhidden runascurrentuser; 
Filename: "{app}\{#NSSM}";
Parameters: "set {#MyAppShortName} AppStderr {app}\{#MyAppShortName}.log";
Flags: runhidden runascurrentuser; 
Filename: "{app}\{#NSSM}";
Parameters: "set {#MyAppShortName} AppRotateFiles 1";
Flags: runhidden runascurrentuser;
Filename: "{sys}\net.exe";
Parameters: "start {#MyAppShortName}";
Flags: runhidden runascurrentuser;

运行时安装程序的日志提示如下所示:

2015-09-07 20:41:22.616   -- Run entry --
2015-09-07 20:41:22.616   Run as: Current user
2015-09-07 20:41:22.616   Type: Exec
2015-09-07 20:41:22.616   Filename: C:\Monitor\nssm.exe
2015-09-07 20:41:22.616   Parameters: install Monitor C:\Monitor\winstart-server.bat
2015-09-07 20:41:24.262   Process exit code: 5
2015-09-07 20:41:24.262   -- Run entry --
2015-09-07 20:41:24.262   Run as: Current user
2015-09-07 20:41:24.262   Type: Exec
2015-09-07 20:41:24.262   Filename: C:\Monitor\nssm.exe
2015-09-07 20:41:24.262   Parameters: set Monitor AppStdin C:\Monitor\Monitor.log
2015-09-07 20:41:24.299   Process exit code: 3
2015-09-07 20:41:24.299   -- Run entry --
2015-09-07 20:41:24.299   Run as: Current user
2015-09-07 20:41:24.299   Type: Exec
2015-09-07 20:41:24.299   Filename: C:\Monitor\nssm.exe
2015-09-07 20:41:24.299   Parameters: set Monitor AppStdout C:\Monitor\Monitor.log
2015-09-07 20:41:24.365   Process exit code: 3
2015-09-07 20:41:24.365   -- Run entry --
2015-09-07 20:41:24.365   Run as: Current user
2015-09-07 20:41:24.365   Type: Exec
2015-09-07 20:41:24.365   Filename: C:\Monitor\nssm.exe
2015-09-07 20:41:24.365   Parameters: set Monitor AppStderr C:\Monitor\Monitor.log
2015-09-07 20:41:24.415   Process exit code: 3
2015-09-07 20:41:24.415   -- Run entry --
2015-09-07 20:41:24.415   Run as: Current user
2015-09-07 20:41:24.415   Type: Exec
2015-09-07 20:41:24.415   Filename: C:\Monitor\nssm.exe
2015-09-07 20:41:24.415   Parameters: set Monitor AppRotateFiles 1
2015-09-07 20:41:24.458   Process exit code: 3

如您所见,第一个任务以 5 失败,然后其他任务提示 3,因为该服务未注册。

有什么线索吗?非常感谢您提前。

4

1 回答 1

1

我认为问题在于 Windows 已经有一个名为“Monitor”的服务(sys/DRIVERS/monitor)。尝试将您的服务名称更改为其他名称!

于 2015-09-08T06:34:49.283 回答