如何在托管服务上实施 .NET Core 运行状况检查? [英] How do I implement .NET Core Health Checks on a Hosted Service?

查看:28
本文介绍了如何在托管服务上实施 .NET Core 运行状况检查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题和标题一样.对数据库操作、查询、命令和事件存储执行检查很简单,但我对如何/什么是对托管服务执行健康检查的最佳方式一无所知.谁能给点建议?

The question is just as asked on the title. It is simple to perform a check for the database operations, queries, commands and event store but I am clueless as to how/what is the best way to perform a health check on a hostedservice. Could anyone advice?

推荐答案

另外来自 Simon B,这个 微软官方文档已经起草了一份完整的指南,为您的托管服务编写健康检查结构.

Additionally from Simon B, this official Microsoft documentation has drafted out a complete guide to writing a health check structure for your Hosted services.

您需要 3 个元素:

  1. 托管服务的 HealthCheck 类
  2. HealthCheck Provider DI,以及 HealthCheck 类的 DI.
  3. HealthCheck 发布者

这篇关于如何在托管服务上实施 .NET Core 运行状况检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆