Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ancplua.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Source: Al0081MissingHealthChecksAnalyzer.cs

Description

Services should register health checks for liveness and readiness probes used by container orchestrators like Kubernetes.

Bad Code

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// No health checks configured

Good Code

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHealthChecks()
    .AddCheck("self", () => HealthCheckResult.Healthy());
var app = builder.Build();
app.MapHealthChecks("/health");

Properties

  • Category: ASP.NET Core
  • Severity: Warning
  • Enabled by default: True
  • Code fix available: False

Configuration

dotnet_diagnostic.AL0081.severity = warning