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

问题

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

早上使用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。

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

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

Step4.根据log,定位问题。

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

我的Application 日志显示如下:

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

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

你可能感兴趣的:(安装Service服务启动报“service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.”解决方案)