From the course: Deploying ASP.NET Core Applications

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Start the application automatically

Start the application automatically

From the course: Deploying ASP.NET Core Applications

Start my 1-month free trial

Start the application automatically

- [Instructor] The Nginx service starts up automatically when the machine boots, but Kestrel and the application have to be started manually. You can use the systemd tool to make sure that Kestrel starts hosting your application whenever the machine restarts. The first thing to do is to create a service definition file. We'll do that with sudo nano /etc/systemd/system/ and we'll call this service hellocoreworld.service. We need to add a couple of things to this configuration file. First a unit section, which just contains a description. We'll say Example .NET web app running on Ubuntu. And we have a service section. The working directory for the service is /var/websites/HelloCoreWorld. Start command is /usr/bin/dotnet and then the path to the DLL file. Let's say we want this to always restart. Basically keep it alive. Provide an identifier for the logs. Just say hellocoreworld. The user it'll run under is me for now, but you could use a service user or a websites user. And specify…

Contents