Health Check with Asp.Net Core – Part 1

Is very important to know if your application is healthy, so you will check to be sure your site is running but is that enough? Maybe your database is responding slowly, maybe your logging has crashed or maybe your server is about to run out of hard drive space.

How would you know that?

You can use health check libraries and asp.net core middleware to verify and report on the health and stability of your application, checking real-time information on the state of your containers and microservices. Furthermore, is possible to monitor physical server resources like the use of memory and disk usage, test app’s dependencies, such as external services endpoint, database, logging, among other functions as you can see below.

Basic use of health check:

Implement health check is easier, it will take a few steps to start to use:

  1. This functionality was released in asp.net core 2.2, to start to use add the nuget package Microsoft.Extensions.Diagnostics.HealthChecks
  2. Add services.AddHealthChecks(); inside the method ConfigureServices on the Startup.Cs
  3. Add endpoints.MapHealthChecks(“healthcheck”); on Startup.cs class. Note you can inform any endpoint name here, I choose healthcheck, but you can choose another name.
  4. Now you will run your application, accessing the endpoint localhost/healthcheck, then you can see if your application is healthy or unhealthy automatically with plain text.

Showing results with more details:

Perhaps, do you need to show more details on your results. It is possible with HealthCheckOptions where you can build a custom output writer and use health check options to inject it into the health check feature.

Access Github to read the complete code:

https://github.com/tatianilima/health-check-basic

76 thoughts on “Health Check with Asp.Net Core – Part 1

  1. Pingback: viagra in usa
  2. Pingback: cialis cheap
  3. Pingback: emospermia bactrim
  4. Pingback: tamoxifen romania
  5. Pingback: valtrex autisme
  6. Pingback: metformin coupons
  7. Pingback: lasix dimagrante
  8. Pingback: gabapentin bun
  9. Pingback: flagyl costco
  10. Pingback: goodrx bactrim
  11. Pingback: 20 mg flexeril
  12. Pingback: contrave pharmacy
  13. Pingback: cozaar class
  14. Pingback: allopurinol 100 mg
  15. Pingback: celecoxib 400 mg
  16. Pingback: actos anales
  17. Pingback: acarbose 25
  18. Pingback: repaglinide canada
  19. Pingback: abilify dosage 5mg
  20. Pingback: synthroid vitex
  21. Pingback: venlafaxine ptsd
  22. Pingback: ivermectin cream

Comments are closed.