Writing a Linux Daemon in C#

When you want to run a .NET Core process as a daemon on Red Hat Enterprise Linux, you can create a custom systemd unit. Today, I’ll write about two examples of custom systemd units for .NET Core. One is a oneshot type for running a .NET Core console application and the other is a simple type for running an ASP.NET Core Web application.
Oneshot Type With a Console Application
Building an App
You can use dotnet run in systemd with the specifying project directory as a working directory. However, let’s build a binary file and use it for systemd. Create your project with dotnet new and edit Program.cs as follows:

Link: https://dzone.com/articles/writing-a-linux-daemon-in-c?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev