在 systemctl 服务上 dotnet run --ulrs

在 systemctl 服务上 dotnet run --ulrs

我需要运行dotnet run --urls https://0.0.0.0:443dotnet core API,但我想将其变成服务,现在我有这个:

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

相关内容