简体   繁体   English

Windows服务无法以“路径”开头。 未找到”

[英]Windows Service failes to start with “Path '.' not found”

Disclaimer: the error message is translated from Swedish (and it's a pain to find the exact corresponding error message in English, Microsoft take note...) The error message could also be "Path ' ' not found" or "Path not found". 免责声明:错误消息是从瑞典语翻译而来的(很难找到英文对应的错误消息,Microsoft注意...)。错误消息也可能是“找不到路径'或“找不到路径” 。 It's a bit unclear due to the Swedish message not enclosing the path in ' '. 由于瑞典语消息未将路径包含在“”中,因此尚不清楚。

This is similar to this question, but not exactly: New Windows Service installed, fails to start: "System error 2 ... system cannot find the file specified" 这类似于此问题,但不完全相同: 安装了新的Windows服务,无法启动:“系统错误2 ...系统找不到指定的文件”

I have written the service myself. 我自己写了服务。 It is an exe written in unmanaged C++ and is using the following external code: 它是一个用非托管C ++编写的exe,并使用以下外部代码:

  • libntlm - loaded as dynamic library (libntlm-0.dll placed in same location as executable) libntlm-作为动态库加载(libntlm-0.dll与可执行文件放置在同一位置)
  • OpenSSL - loaded as static library OpenSSL-作为静态库加载
  • pugixml - compiled directly into code pugixml-直接编译成代码

The problem I'm having is that it doesn't start when Windows starts, but it does start if I manually start it! 我遇到的问题是Windows启动时无法启动,但是如果我手动启动,它会启动! I am stumped as to what could be wrong. 我为可能出什么问题而感到困惑。 The only thing I can think of is if perhaps the dll can't be found, but I don't know why it wouldn't. 我唯一能想到的是,也许找不到dll,但我不知道为什么找不到它。 Something with the environment variables being different perhaps? 环境变量可能有所不同吗?

What I have tried: 我尝试过的

  • Checked registry, path is correct 检查注册表,路径正确
  • Path is to local disk 路径是本地磁盘
  • Changed to a number of different paths (no change) 更改为许多不同的路径(不变)
  • Made sure there are no spaces in the path 确保路径中没有空格
  • Logging at start of program (nothing written to log, so it's not an internal path not found error) 在程序启动时进行日志记录(未写入日志,因此不是内部路径未找到错误)
  • Dll is in same path DLL处于同一条路径
  • Set to start with my own network account (no change) 设置为以我自己的网络帐户开始(不变)
  • Tried renaming exe to be the same as service name (no change) 尝试将重命名exe与服务名称相同(不变)
  • Tried registering libntlm-0.dll with regsrv32 but that didn't work 尝试使用regsrv32注册libntlm-0.dll,但是没有用
  • Put libntlm-0.dll in System32 (no change) 将libntlm-0.dll放入System32(不变)

For posterity it seems like the delayed start suggested by 51k seems to work. 对于后代来说,似乎51k建议的延迟启动似乎有效。 I don't know why that should make any difference, but as long as it works I'm happy. 我不知道为什么那应该有什么不同,但是只要能奏效,我就会很高兴。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM