首页 > 解决方案 > NSSM 无法启动 windows 服务

问题描述

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

MyService:响应 START 控制的意外状态 SERVICE_PAUSED。

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

无法启动服务。服务进程无法连接到服务控制器

虽然我可以使用 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 是如何工作的......

标签: wpfwindowsservicenssm

解决方案


我找到了答案!

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

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


推荐阅读