본문 바로가기

Software/.Net Core

리눅스에서 .net 웹앱을 서비스로 등록 시, "Could not find a part of the path" 에러가 발생할 때

 

systemctl의 .service 구성파일인

/etc/systemd/system폴더의 {{앱이름}}.service 파일을 열어서

 

# {실행할 서비스명}.service 파일

[Unit]
Description=Unity Project server daemon

[Service]
#보통 장기적으로 수행해야 하는 경우 simple이 가장 적합하다.
Type=simple
#dotnet의 경우 dotnet 경로를 앞에 붙이고
#뒤에 실행할 파일의 경로 및 파일이름을 기재해야 한다.
ExecStart=/usr/bin/dotnet /{실행할 파일 경로 포함.dll}
# ensure the service restarts after crashing
Restart=always
# amount of time to wait before restarting the service
RestartSec=5
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

 

이 안에  

WorkingDirectory=/wwwroot/프로젝트디렉토리

를 추가 해주면 됩니다.