Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

ASP.NET full framework implementation of ASP.NET Core health checks.

License

Notifications You must be signed in to change notification settings

ritterim/RimDev.AspNet.Diagnostics.HealthChecks

Repository files navigation

RimDev.AspNet.Diagnostics.HealthChecks

ASP.NET full framework implementation of ASP.NET Core health checks.

Usage

The recommended installation method is the RimDev.AspNet.Diagnostics.HealthChecks NuGet package.

PM> Install-Package RimDev.AspNet.Diagnostics.HealthChecks

Then, use it like this in an OWIN Startup class:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseHealthChecks(
            "/_health",
            new NoopHealthCheck(),
            new PingHealthCheck(new PingHealthCheckOptions().AddHost("localhost", 1000)));
    }
}

Usage with Health Checks UI

To use with the Health Checks UI project named health checks should be used and a special ResponseWriter needs to be configured. This returns the checks with more specific information about each check in a format that the UI project can read.

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseHealthChecks(
            "/_health_ui",
            new HealthCheckOptions
            {
                ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
            },
            new HealthCheckWrapper(new NoopHealthCheck(), "Noop health check"),
            new HealthCheckWrapper(new PingHealthCheck(new PingHealthCheckOptions().AddHost("localhost", 1000)), "Ping to localhost"));
    }
}

The UI can't be hosted in a full framework app but can easily be setup using the official docker image for those who doesn't already have a UI project set up.

Requirements

  • .NET Framework 4.6.2 or later

License

MIT

About

ASP.NET full framework implementation of ASP.NET Core health checks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published