安装Service服务启动报“service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.”解决方案

问题

早上使用SC命令部署Service,启动服务一直报The **** service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.

换成Install.bat又报“The service did not report an error.More help is available by typing NET HELPMSG 3534.”

终于在各种查资料后,得到了解决。

解决步骤

step1, 快捷键Windows + R 打开Run。

Step2. 输入eventvwr.msc ,回车,打开 Event Viewer。

Step3. 点击Windows Log -> Application 查找对应的Service的Error log查看详情。

Step4.根据log,定位问题。

我的Application 日志显示如下:

根据log文件,可见是因为路径的问题。

分析:因为Service启动需要向指定磁盘写内容如log,我本机环境没有D盘,但是Service的Condig文件中配置的是向D盘写。这就导致它找到D盘,无法写成功从而启动失败。最终将路径指向了其他盘,Service启动成功。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容