Microsoft.Extensions.Hosting.Systemd 9.0.0-rc.1.24431.7
About
Provides an implementation for hosting an application as a Linux systemd service.
The package ensures proper communication between .NET applications and systemd, making it easier to build, deploy, and run applications as Linux services.
Key Features
- Systemd service integration
- Health check support
- Logging and diagnostics with different log levels
- Notify systemd on application state changes
How to Use
Wherever you configure your host, add the UseSystemd
method to the builder chain:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSystemd() // Enable running as a Systemd service
.ConfigureServices((hostContext, services) =>
{
...
});
The UseSystemd
method will no-op when not running as a daemon, allowing normal debugging or production use both with and without systemd.
Registering the service requires a special file, called a unit file, to be added to the /etc/systemd/system
directory.
For more information on this part, check the run your app as a Linux service with systemd guide.
Main Types
The main types provided by this library are:
Microsoft.Extensions.Hosting.Systemd.SystemdNotifier
Microsoft.Extensions.Hosting.Systemd.SystemdLifetime
Microsoft.Extensions.Hosting.SystemdHostBuilderExtensions
Additional Documentation
Related Packages
Feedback & Contributing
Microsoft.Extensions.Hosting.Systemd is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
No packages depend on Microsoft.Extensions.Hosting.Systemd.
.NET 8.0
- Microsoft.Extensions.Hosting (>= 9.0.0-rc.1.24431.7)
.NET 9.0
- Microsoft.Extensions.Hosting (>= 9.0.0-rc.1.24431.7)
.NET Standard 2.1
- Microsoft.Extensions.Hosting (>= 9.0.0-rc.1.24431.7)