共用方式為


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

參數

傳回

可以從中註冊健康狀態檢查的 IHealthChecksBuilder 執行個體。

備註

這項作業是等冪的 - 多個調用仍然只會在 中IServiceCollection產生單HealthCheckService一實例。 您可以多次叫用它,以在多個位置存取 IHealthChecksBuilder

適用於