linux - 在步骤 CHDIR 生成 "/usr/bin/dotnet": No such file or directory 时失败

标签 linux asp.net-core deployment

我尝试按照 https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.1&tabs=aspnetcore2x 将 ASP.NET Core 2 网站部署到 Ubuntu .

但是,它抛出一个异常:

Failed at step CHDIR spawning "/usr/bin/dotnet": No such file or directory from the file

错误来自这个文件

 [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

但是/usr/bin/dotnet这个命令是存在的,我运行的时候没问题

/usr/bin/dotnet /var/aspnetcore/hellomvc/hellomvc.dll

我用谷歌搜索了一下,但我找到的最佳答案表明它与用户 www-data 有关。我仍然无法弄清楚出了什么问题。任何帮助将不胜感激。

最佳答案

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

希望对您有所帮助。

关于linux - 在步骤 CHDIR 生成 "/usr/bin/dotnet": No such file or directory 时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50166985/

相关文章:

linux - Ubuntu 中的 PATH 变量设置在哪里?

c# - asp.net core DI 只注入(inject)单例,作用域和 transient 不工作

c# - 关于将 WCF 托管为 Windows 服务的问题

deployment - 如何部署对 Cassandra CQL 架构的更改

maven - 使用Maven部署后如何运行测试?

java - 在 Linux OpenSuse cron 上,脚本运行,但只生成空日志

php - 百胜依赖问题

Android 模拟器在缩放到实际大小时显示很奇怪

visual-studio - 如何在 ASP.NET 5 中执行 Web 部署?

c# - 在 beta8 中的 ConfigurationBuilder 中指定应用程序基路径