Posts

Showing posts with the label Asp.Net Core. .Net Core 2.2 HealthCheck

Using custom health checks with Asp.Net Core 2.2

Image
I almost burst with cries of joy when I saw the release of .Net Core 2.2 with the much needed built in and standardized health checks. The preview was great and with each version until the release new blog posts emerged eager to show to the world the new wonder. But as I do like my frameworks fully baked and released I waited patiently for the real deal.
TL;DR Implement your own service from IHealthCheck and inject it with whatever you want. It just works!
Reading the instructions... The best article I found for the new healthcheck API was this one based on preview code and the best code samples where of course the official samples. However by looking at them something was missing. So I went on a quest to achieve what suited my needs. And my needs are simple. I need to be able to inject some testing code to my custom health check module.
On to the code After I practiced a little bit with the concept of tags I just added a health checking service to the standard DI container as such Odd…