ASP.NET full framework implementation of ASP.NET Core health checks.
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)));
}
}
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.
- .NET Framework 4.6.2 or later
MIT