I would like to setup Microsoft.Extensions.Diagnostics.HealthChecks so that I can setup response body within controller instead of standard setup in Startup.cs. Is this possible? If so, how can I achieve this?
The thought here is that I would like control over the response payload setter logic, and to do this within a controller action/method.
Online contains clear instructions on how to setup healthcheck probes, but all examples show the setup occuring within Startup.cs.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-3.1
Are probes strickly setup within startup only? Is this a constraint?
My understanding is that the healtcheck library is middleware that will terminate request from going further down the middleware pipeline, and that perhaps removing the middleware will mean that whatever was setup in startup must now be setup within controller action method.
Is it possible to setup healthcheck probes within controller action methods? Answer is No
You can use
app.UseHealthChecks
to have custom control on health check enpoint