LogOtter.SimpleHealthChecks 3.0.0

dotnet add package LogOtter.SimpleHealthChecks --version 3.0.0
                    
NuGet\Install-Package LogOtter.SimpleHealthChecks -Version 3.0.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="LogOtter.SimpleHealthChecks" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LogOtter.SimpleHealthChecks" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="LogOtter.SimpleHealthChecks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LogOtter.SimpleHealthChecks --version 3.0.0
                    
#r "nuget: LogOtter.SimpleHealthChecks, 3.0.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.
#:package LogOtter.SimpleHealthChecks@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LogOtter.SimpleHealthChecks&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=LogOtter.SimpleHealthChecks&version=3.0.0
                    
Install as a Cake Tool

SimpleHealthChecks

A library to expose health checks over HTTP for use in worker services without using the Microsoft.NET.Sdk.Web SDK.

Usage

  1. Register Microsoft.Extensions.Diagnostics.HealthChecks as normal
services
    .AddHealthChecks()
    .AddCheck<MyCustomCheck>("CustomCheck")
  1. Register the SimpleHealthChecks and expose an endpoint
services
    .AddSimpleHealthChecks()
    .AddEndpoint("/health")

Options

By default, the health checks we be exposed on port 80 on all IP addresses. To configure, set the SimpleHealthCheckHostOptions

services
    .AddSimpleHealthChecks(options => {
        options.Host = "127.0.0.1";
        options.Port = 8080;
    });

Customize

Healthcheck endpoints can be filter checks and customize their response in the same way as the Microsoft.Extensions.Diagnostics.HealthChecks can.

Example: Filter checks for different endpoints

services
    .AddSimpleHealthChecks()
    .AddEndpoint("/health/ready", new SimpleHealthCheckOptions()
    {
        Predicate = check => check.Tags.Contains("ready"),
    })
    .AddEndpoints("/health/live", new SimpleHealthCheckOptions());

Example: Custom response

services
    .AddSimpleHealthChecks()
    .AddEndpoint("/health", new SimpleHealthCheckOptions
    {
        ResponseWriter = WriteResponse
    });
private static Task WriteResponse(HttpListenerContext context, HealthReport healthReport)
{
    context.Response.Headers[HttpRequestHeader.ContentType] = "application/json; charset=utf-8";

    var options = new JsonWriterOptions { Indented = true };

    using var memoryStream = new MemoryStream();
    using (var jsonWriter = new Utf8JsonWriter(memoryStream, options))
    {
        jsonWriter.WriteStartObject();
        jsonWriter.WriteString("status", healthReport.Status.ToString());
        jsonWriter.WriteStartObject("results");

        foreach (var healthReportEntry in healthReport.Entries)
        {
            jsonWriter.WriteStartObject(healthReportEntry.Key);
            jsonWriter.WriteString("status", healthReportEntry.Value.Status.ToString());
            jsonWriter.WriteString("description", healthReportEntry.Value.Description);
            jsonWriter.WriteStartObject("data");

            foreach (var item in healthReportEntry.Value.Data)
            {
                jsonWriter.WritePropertyName(item.Key);

                JsonSerializer.Serialize(jsonWriter, item.Value, item.Value?.GetType() ?? typeof(object));
            }

            jsonWriter.WriteEndObject();
            jsonWriter.WriteEndObject();
        }

        jsonWriter.WriteEndObject();
        jsonWriter.WriteEndObject();
    }

    return context.Response.OutputStream.WriteAsync(memoryStream.ToArray().AsMemory()).AsTask();
}

Running locally

In order to run locally, you'll either need to run with Admin permissions or run netsh as an administrator first:

# Run as Administrator
# Note: change port 80 if required
netsh http add urlacl url=http://+:80/ user=$env:USERDOMAIN\$env:USERNAME
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
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
3.0.0 131 4/16/2026
2.0.4 222 11/4/2025
2.0.2 222 8/4/2025
2.0.1 257 4/16/2025
2.0.0 226 4/10/2025
2.0.0-alpha1 212 3/20/2025
1.2.0 162 1/16/2025
1.1.2 211 11/18/2024
1.0.1 4,095 3/8/2024
1.0.0 321 11/30/2023
Loading failed