步骤CHDIR产生"/ usr/bin/dotnet"失败:没有这样的文件或目录

use*_*111 5 linux deployment asp.net-core

我试图部署ASP.NET的Core 2网站的Ubuntu以下https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.1&tabs=aspnetcore2x.

但是,它会引发异常:

Failed at step CHDIR spawning "/usr/bin/dotnet": No such file or directory from the file
Run Code Online (Sandbox Code Playgroud)

错误来自此文件

 [Unit]
 Description=Example .NET Web API App 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=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)

但是,命令/ usr/bin/dotnet存在,我跑的时候没问题

/usr/bin/dotnet /var/aspnetcore/hellomvc/hellomvc.dll
Run Code Online (Sandbox Code Playgroud)

我用Google搜索了,但我发现的最佳答案表明它与用户www-data有关.我仍然无法弄清楚出了什么问题.任何帮助将不胜感激.

小智 10

查看WorkingDirectory路径,直接cd到路径.就我而言,缺少WorkingDirectory路径文件夹,当我手动创建它时,它开始工作.

希望这有帮助.