A systemd daemon is a long-running .NET worker service deployed on Linux without an HTTP interface. It uses the generic IHost for configuration, logging, dependency injection, and hosted background tasks, avoiding the additional ASP.NET Core HTTP pipeline. section 34.2
Prepare a worker for systemd by adding Microsoft.Extensions.Hosting.Systemd and enabling systemd integration on IHostBuilder with the systemd extension method. The same application can remain a console app during development; service-integration packages do nothing in that mode. section 34.2.2 section 34.4
A typical systemd-hosted worker combines:
- A BackgroundService or other IHostedService that performs repeated, scheduled, batch, or event-driven work. section 34.2
- Generic-host configuration through IHostBuilder.ConfigureServices(), rather than the WebApplicationBuilder minimal-hosting APIs. section 34.4
- Optional application services such as HttpClient and Entity Framework Core registered through dependency injection. section 34.2.1
Exchange-rate worker
A headless worker can periodically retrieve exchange rates and save them to a database. Other applications can then consume the stored rates without the worker exposing a user interface or handling HTTP requests. section 34.2.1 section 34.2
