Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I tried to deploy the ASP.NET Core 2 website to Ubuntu following https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.1&tabs=aspnetcore2x.

However, it throws an exception:

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

The error is from this 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

However, the command /usr/bin/dotnet exists, and it's fine when I ran

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

I googled it, but the best answer I found suggested it's related to the user www-data. Still I could not figure out what's wrong. Any help would be greatly appreciated.

like image 649
user1111 Avatar asked May 04 '18 04:05

user1111


1 Answers

Look at for the WorkingDirectory path, cd to the path directly. In my case, WorkingDirectory path folder was missing and when I created it manually it started working.

Hope this help.

like image 100
Praveen Patel Avatar answered Sep 21 '22 16:09

Praveen Patel