問題

早上使用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.根據(jù)log,定位問題。

我的Application 日志顯示如下:
根據(jù)log文件,可見是因為路徑的問題。
分析:因為Service啟動需要向指定磁盤寫內(nèi)容如log,我本機環(huán)境沒有D盤,但是Service的Condig文件中配置的是向D盤寫。這就導致它找到D盤,無法寫成功從而啟動失敗。最終將路徑指向了其他盤,Service啟動成功。