NSSM 无法启动 windows 服务

NSSM can't start windows service

我正在尝试 运行 我的 wpf 服务与 nssm 服务管理器。问题是使用 nssm 我可以安装服务,但是当我尝试启动它时,我在终端中得到以下响应:

MyService: Unexpected status SERVICE_PAUSED in response to START control.

然后在 EventViewer 中出现以下错误:

Service cannot be started. The service process could not connect to the service controller

虽然我可以使用 NET 命令或使用 VisualStudio 启动我的服务,但是这个问题只发生在 nssm 上...

框架: .NET 框架 4.6.1

关于如何解决这个问题有什么建议吗?

编辑 1

我使用 https://docs.microsoft.com/en-us/dotnet/framework/windows-services/walkthrough-creating-a-windows-service-application-in-the-component-designer 示例创建了示例 WPF 服务。结果还是一样。

编辑 2

我遇到了 NSSM 错误:

Cannot start service from the command line or a debugger.  A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.

我现在不明白 nssm 是如何工作的....

您可以尝试将NET COMMANDS 制作成一个bat 文件。然后使用NSSM制作bat文件即可服务

我找到答案了!

我太笨了,没有意识到 nssm 是一个服务管理器,我尝试 运行 用它来 windows 服务...

我需要做的就是制作一个简单的控制台应用程序而不是服务...