在oracle linux上自动运行dotnet服务

时间:2017-07-20 17:37:39

标签: .net linux oracle core systemd

将以下代码复制到Texteditor并将其保存为YourServiceName.services "/etc/systemd/system"路径

[Unit]
Description=MyServiceDescription

[Service]
WorkingDirectory=/opt/<MyServicePath>
ExecStart=opt/dotnet/shared/Microsoft.NETCore.App/1.1.2/dotnet /opt/<MyPath>/<MyService>.dll

[Install]
WantedBy=multi-user.target

打开命令框并执行以下命令:

systemctl enable <YourServiceName>.service
systemctl start <YourServiceName>.service
systemctl status <YourServiceName>.service -l

常见的错误是 - .../dotnet/opt/...之间缺少空格 - 落在/opt/dotnet/dotnet文件位置的dotnet文件 - 没有列出的工作目录(dotnet找不到appsettings.json文件)

0 个答案:

没有答案