wpf - 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 是如何工作的......
解决方案
我找到了答案!
我太笨了,没有意识到 nssm 是一个服务管理器,我试图用它运行一个 Windows 服务......
我需要做的就是制作一个简单的控制台应用程序而不是服务......
推荐阅读
- php - PHP日期不适用于保存的值时间戳
- decorator - 没有在其他函数中调用装饰器
- php - 从数组中减去只是删除前 2 个字符?
- android - Android 模拟器:无法初始化 WHPX
- java - Firebase - Firestore 数据查询两次调用两次
- android - JSON 解析需要 30 秒
- c# - .Net Core 响应重定向另一个视图
- java - 无法在 adb shell 中使用 su 命令
- sql - 从一系列带有日期的发票中,我如何按发票月份和上一个发票月份汇总它们?
- sql - ORA-00904: "TYPE": 触发器上的标识符无效。我哪里出错了?