【发布时间】:2019-10-02 00:05:28
【问题描述】:
Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult
public HealthCheckResult (Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string description = null, Exception exception = null, System.Collections.Generic.IReadOnlyDictionary<string,object> data = null);
Parameters
status HealthStatus
A value indicating the status of the component that was checked.
description String
A human-readable description of the status of the component that was checked.
exception Exception
An Exception representing the exception that was thrown when checking for status (if any).
data IReadOnlyDictionary<String,Object>
Additional key-value pairs describing the health of the component.
不幸的是,试错表明description 未在运行状况检查端点响应中返回。
catch(Exception ex)
{
return new HealthCheckResult(status: HealthStatus.Unhealthy,
description: ex.Message,
exception: ex);
}
我认为异常消息会在响应中返回并显示在浏览器中,但事实并非如此。
除了DegradedHealthyUnhealthy等之外,是否有一种未记录的机制来返回其他信息?
【问题讨论】:
标签: asp.net-core-webapi health-monitoring