Dotnet은 systemctl 서비스에서 --ulrs를 실행합니다.

Dotnet은 systemctl 서비스에서 --ulrs를 실행합니다.

dotnet core API를 실행해야 dotnet run --urls https://0.0.0.0:443하지만 이를 서비스로 전환하고 싶습니다. 이제 다음이 있습니다.

sudo nano /etc/systemd/system/mdvAPI.service

[Unit]
Description=Dotnet API MDV

[Service]
WorkingDirectory=/home/g67Admin/projeto_integrador_grupo67/mdv/
ExecStart=dotnet run --urls https://0.0.0.0:443

[Install]
WantedBy=multi-user.target

시작하려고 하면 다음과 같은 결과가 나타납니다.

sudo systemctl start mdvAPI.service

Failed to start mdvAPI.service: Unit mdvAPI.service is not loaded properly: Exec format error.
See system logs and 'systemctl status mdvAPI.service' for details.

내가 여기서 뭘 잘못하고 있는 걸까?

답변1

나는 다음 시스템 서비스 스크립트를 개발했습니다.

[Unit]
Description=Whatever you want

[Service]
WorkingDirectory=/path/to/my/project
ExecStart=/usr/bin/dotnet run --urls https://0.0.0.0:443
User=root
Group=root

[Install]
WantedBy=multi-user.target

관련 정보