Rychusoft.PidFileManager 2.2.0

dotnet add package Rychusoft.PidFileManager --version 2.2.0
NuGet\Install-Package Rychusoft.PidFileManager -Version 2.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rychusoft.PidFileManager" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rychusoft.PidFileManager --version 2.2.0
#r "nuget: Rychusoft.PidFileManager, 2.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rychusoft.PidFileManager as a Cake Addin
#addin nuget:?package=Rychusoft.PidFileManager&version=2.2.0

// Install Rychusoft.PidFileManager as a Cake Tool
#tool nuget:?package=Rychusoft.PidFileManager&version=2.2.0

PID file manager

Takes care of creating and deleting PID file in ASP.Net Core applications. Mechanics on which the library is based are described in this article. You can also find there information on how to create a systemd service that creates /var/run/yourapp/ directory with necessary write permissions for you.


  1. Install nuget package:
dotnet add package Rychusoft.PidFileManager
  1. In the Startup.cs add services.AddPidFileHostedService(Configuration.GetSection("PidFileOptions")); to the ConfigureServices() method:
public class Startup

    public void ConfigureServices(IServiceCollection services)


  1. In the appsettings.json add new section - note that the user under which your app is run need to have a privilages to write to this path:
"PidFileOptions": {
  "PidFilePath": "/var/run/yourapp/yourapp.pid"
  1. In the appsettings.Development.json add new section that will disable creating PID file when running in development environment (e.g., from Visual Studio):
"PidFileOptions": {
  "IsDisabled": true


  1. You can configure the service as shown above, in the Usage section, by calling services.AddPidFileHostedService(Configuration.GetSection("PidFileOptions"));. Possible appsettings properties:
  • PidFilePath - string - full file path where the PID file will be created
  • IsDisabled - bool - if set to true then service will not create a PID file. Useful for disabling the service in development environment.
  1. You can configure the service by providing a lambda expression that yields an instance of the options class:
services.AddPidFileHostedService(options =>
    options.PidFilePath = "/var/run/yourapp/yourapp.pid";
    options.IsDisabled = false;
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 461 2/27/2022
2.1.0 390 2/27/2022
2.0.4 381 2/20/2022
2.0.3 383 2/20/2022
2.0.2 387 2/20/2022
2.0.1 393 2/20/2022
1.0.0 402 2/20/2022