Service cannot be started. System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo).
给程序目录赋读写权限尝试过没有效果;
程序可以直接运行,但注册为服务后就是无法启动,一启动就报上面的错误信息。
最后更新程序安装服务内的代码,追加工作目录的属性设置,问题解决。
Process process = new Process();
process.StartInfo.FileName = @"D:\ABC\ABCAAA.exe";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WorkingDirectory = @"D:\ABC"; /追加工作目录的属性设置
process.Start();