HealthCheckServiceCollectionExtensions.AddHealthChecks 方法

定义

使用提供的委托注册运行状况检查,以将 HealthCheckService 添加到容器中。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHealthChecksBuilder ^ AddHealthChecks(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddHealthChecks (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddHealthChecks : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder
<Extension()>
Public Function AddHealthChecks (services As IServiceCollection) As IHealthChecksBuilder

参数

services
IServiceCollection

要向其中添加 HealthCheckServiceIServiceCollection

返回

可从中注册运行状况检查的 IHealthChecksBuilder 实例。

注解

此操作是幂等的 - 多次调用仍然只导致 中的IServiceCollection单个HealthCheckService实例。 可以多次调用它,以便在多个位置访问 IHealthChecksBuilder

适用于