* Allow health checks to use any DI lifetime
This change allows registered IHealthCheck implementations to use any DI
lifetime. This is necessary for scenarios like using EF which requires a
scope.
The works by having the health check service create a scope for each
time it queries health checks. This scope does not overlap or share
state with other scopes (the request scope) so there is no crosstalk
between processing going on per-request in ASP.NET Core and the health
check operation.
* PR feedback and some logging cleanup
* Remove JSON output and convert to sample
GlennC and I made the decisison to turn the JSON output into a sample
rather than something we support out of the box. We wouldn't tell
customers to definitely use it and we don't want to introduce more
coupling to JSON.NET.
This allows each middleware to be configured with a specific set of
checks (by name). See the comments in the sample for how this is
frequently used.
This is also addresses aspnet/Home#2575 - or at least the part that we
plan to do. We think that any sort of built-in system of metadata or
tags is vast overkill, and doesn't really align with the primary usage
of health checks.
We're providing building blocks, and these can be put together to
build more complicated things like what's described in aspnet/Home#2575.