Update service file to set WorkingDirectory

Since the ASP.NET Core application is run from /etc/systemd/system directory, the working directory is no longer /var/aspnetcore/hellomvc. Update the service file to set WorkingDirectory=/var/aspnetcore/hellomvc so that the program will run. Otherwise, users will get System.IO.FileNotFoundException when using systemd to monitor and run ASP.NET Core application.
pull/2653/head
Paul Kim 2017-02-01 18:15:39 -08:00 committed by GitHub
parent 695fe823f0
commit cf3162922e
1 changed files with 1 additions and 0 deletions

View File

@ -122,6 +122,7 @@ An example service file for our application.
Description=Example .NET Web API Application running on Ubuntu Description=Example .NET Web API Application running on Ubuntu
[Service] [Service]
WorkingDirectory=/var/aspnetcore/hellomvc
ExecStart=/usr/bin/dotnet /var/aspnetcore/hellomvc/hellomvc.dll ExecStart=/usr/bin/dotnet /var/aspnetcore/hellomvc/hellomvc.dll
Restart=always Restart=always
RestartSec=10 # Restart service after 10 seconds if dotnet service crashes RestartSec=10 # Restart service after 10 seconds if dotnet service crashes