Share via


HealthCheckService.CheckHealthAsync Method

Definition

Overloads

CheckHealthAsync(CancellationToken)

Runs all the health checks in the application and returns the aggregated status.

CheckHealthAsync(Func<HealthCheckRegistration,Boolean>, CancellationToken)

Runs the provided health checks and returns the aggregated status

CheckHealthAsync(CancellationToken)

Source:
HealthCheckService.cs
Source:
HealthCheckService.cs
Source:
HealthCheckService.cs

Runs all the health checks in the application and returns the aggregated status.

public System.Threading.Tasks.Task<Microsoft.Extensions.Diagnostics.HealthChecks.HealthReport> CheckHealthAsync (System.Threading.CancellationToken cancellationToken = default);
member this.CheckHealthAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.Diagnostics.HealthChecks.HealthReport>
Public Function CheckHealthAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of HealthReport)

Parameters

cancellationToken
CancellationToken

A CancellationToken which can be used to cancel the health checks.

Returns

A Task<TResult> which will complete when all the health checks have been run, yielding a HealthReport containing the results.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

CheckHealthAsync(Func<HealthCheckRegistration,Boolean>, CancellationToken)

Source:
HealthCheckService.cs
Source:
HealthCheckService.cs
Source:
HealthCheckService.cs

Runs the provided health checks and returns the aggregated status

public abstract System.Threading.Tasks.Task<Microsoft.Extensions.Diagnostics.HealthChecks.HealthReport> CheckHealthAsync (Func<Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckRegistration,bool>? predicate, System.Threading.CancellationToken cancellationToken = default);
abstract member CheckHealthAsync : Func<Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckRegistration, bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.Diagnostics.HealthChecks.HealthReport>
Public MustOverride Function CheckHealthAsync (predicate As Func(Of HealthCheckRegistration, Boolean), Optional cancellationToken As CancellationToken = Nothing) As Task(Of HealthReport)

Parameters

predicate
Func<HealthCheckRegistration,Boolean>

A predicate that can be used to include health checks based on user-defined criteria.

cancellationToken
CancellationToken

A CancellationToken which can be used to cancel the health checks.

Returns

A Task<TResult> which will complete when all the health checks have been run, yielding a HealthReport containing the results.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to