AspNetCore.Diagnostics.HealthChecks icon indicating copy to clipboard operation
AspNetCore.Diagnostics.HealthChecks copied to clipboard

Multiple health checks are not working.

Open jeyamaal opened this issue 10 months ago • 0 comments

Multiple health checks are not working:

Initially, multiple health checks are working for 6.0.2 version but it is not working in 8.0.1 version. Please enable multiple health checks since we are using readOnly and readWrite database instances.

Error message:

'Duplicate health checks were registered with the name(s): mysql (Parameter 'registrations')'

Source code:

services.AddHealthChecks()
    .AddCheck("self", () => HealthCheckResult.Healthy())
    .AddMySql(
        readOnlyDbConnectionString, 
        nameof(DataContext), 
        tags: new[] { "services" }
    )
    .AddMySql(
        readWriteDbConnectionString, 
        nameof(ReadOnlyDataContext), 
        tags: new[] { "services" }
    );

Environment:

.NET Core version 8 Healthchecks version 8.0.1 Operative system: Windows

jeyamaal avatar Feb 17 '25 07:02 jeyamaal