HealthCheckServiceCollectionExtensions.AddHealthChecks(IServiceCollection) 方法
定義
使用提供的委派來註冊健康狀態檢查,以將 HealthCheckService 新增至容器。Adds the HealthCheckService to the container, using the provided delegate to register health checks.
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
要新增 HealthCheckService 的 IServiceCollection。The IServiceCollection to add the HealthCheckService to.
傳回
可以從中註冊健康狀態檢查的 IHealthChecksBuilder 執行個體。An instance of IHealthChecksBuilder from which health checks can be registered.
備註
這項作業具有等冪性-多個調用仍然只會在 IServiceCollection 中產生單一 HealthCheckService 實例。This operation is idempotent - multiple invocations will still only result in a single HealthCheckService instance in the IServiceCollection. 可以多次叫用它,以在多個位置取得 IHealthChecksBuilder 的存取權。It can be invoked multiple times in order to get access to the IHealthChecksBuilder in multiple places.