liveBook · Manning

UseSystemd()

As explained in ASP.NET Core in Action, 3e

AddSystemd() is a .NET host-builder method that configures an application for systemd service integration.

UseSystemd() adds systemd integration to a .NET worker service or ASP.NET Core application through the generic host. It prepares the application to run as a Linux systemd daemon. section 34.2.2 section 34.4

Enable systemd support by completing these setup steps:

  • Add the Microsoft.Extensions.Hosting.Systemd NuGet package. section 34.2.2
  • Call UseSystemd() on the IHostBuilder while configuring the application in Program.cs. section 34.2.2
  • Keep using the generic host APIs, including IHostBuilder.ConfigureServices(), for worker-service configuration. section 34.4
  • Run the same application as a console app during development; service integration does nothing in that mode. section 34.4

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines the required package and host-builder call but does not detail daemon installation or systemd unit configuration.
Examples
Uses a worker service configured through IHostBuilder and contrasts systemd deployment with Windows Service and console execution.
What it assumes
Assumes familiarity with .NET worker services and IHostBuilder while identifying the required NuGet package and method call.
What you can do after
Operate a worker service as a Linux systemd daemon while retaining console execution for development and testing.
How it connects
Connects worker services with generic hosting, dependency injection, logging, configuration, and Windows Service integration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.