Linux1604:kestrel服务可以';找不到dotnet安装
我得到以下错误:Linux1604:kestrel服务可以';找不到dotnet安装,linux,.net-core,kestrel,Linux,.net Core,Kestrel,我得到以下错误: Jun 03 06:41:04 {my_digital_ocean_server} systemd[13752]: kestrel-hellomvc.service: Failed at step CHDIR spawning /usr/bin/dotnet: No such file or directory -- Subject: Process /usr/bin/dotnet could not be executed -- Defined-By: systemd --
Jun 03 06:41:04 {my_digital_ocean_server} systemd[13752]: kestrel-hellomvc.service: Failed at step CHDIR spawning /usr/bin/dotnet: No such file or directory
-- Subject: Process /usr/bin/dotnet could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /usr/bin/dotnet could not be executed and failed.
运行时:
systemctl start kestrel-hellomvc.service
遵循本指南:
运行:nano/usr/bin/dotnet
获取一个包含内容的大文件,以及哪个dotnet
返回
/usr/bin/dotnet,因此文件确实存在
为什么我会出现这个错误,解决方法是什么
编辑:
My/etc/systemd/system/kestrel-hellomvc.service文件:
[Unit]
Description=Example .NET Web API Application running on Ubuntu
[Service]
WorkingDirectory=/var/aspnetcore/hellomvc
ExecStart=/usr/bin/dotnet /var/aspnetcore/hellomvc/hellomvc.dll
Restart=always
RestartSec=10 # Restart service after 10 seconds if dotnet service crashes
SyslogIdentifier=dotnet-example
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
Dotnet可能不在usr/bin中。在Ubuntu服务器16.04上,我的文件位于/usr/share/dotnet,服务文件中的可执行行是/usr/share/dotnet/dotnet。Do
which dotnet
查找应用程序服务文件的正确路径/etc/systemd/system/kestrel MyAppName.service
属性
ExecStart=/bin/dotnet /var/www/dev-slc1.almw.local/public_html/MyAppName.dll
例如,在CentOS7
上,哪个dotnet
会产生上述结果:/bin/dotnet
尝试以root用户身份运行ExecStart
命令。您可能会遇到不同的问题。