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

おすすめ記事