Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这不可能很难找到......但它是!似乎每年一次我想从预编译的 .exe 程序创建一个 Windows 服务。每次我最终都试图记住我忘记的东西。
现在我看到有一个带有 powershell 的“新服务”cmdlet。伟大的!除了 binpath 显然不应该是您要启动的实际 .exe 的路径。:(
有人可以告诉我简单,现代的方法吗?
-编辑 -
作为记录,我知道如何使用 srvany.exe 或 instsrv.exe 来做到这一点......我只是在寻找现代的 2012 方式(如果存在的话)。
我的理解是它不能是任何可执行文件。
它需要有一个服务入口点,例如OnStart. 看这里:
OnStart
错误 1053 服务没有响应启动或控制请求