简体   繁体   中英

How should I implement a supported health check for .NET Core 2.1?

For a .NET Core 2.0 project, I used Microsoft standard health check libraries which are clearly documented based on code for .NET Core 2.0 . Since less than a month, suddenly, this is deprecated . The new readme file, refers to an alternative for .NET Core 2.2 .However, the version of .NET Core that is production ready, recommended and has long term support , is version 2.1 which is exactly what I use now for a new project.

So I am in trouble. What is the supported way of implementing health checks for .NET Core 2.1? This used to be clear for .NET Core 2.0 and shall be clear for .NET Core 2.2 but for .NET Core 2.1 it is unclear what I should do.

You answered your own question actually, with the reference links.

ASP.NET Core 2.2 comes with its own official heath check, see Docs and the ASP.NET Core 2.2.0-preview1 blog post for the new health service.

You can use either one (2.2 or your old solution) for the ASP.NET Core 2.x life-time. Since the old one is deprecated it won't be updated for newer versions of ASP.NET Core, but you should expect it to work for the 2.x lines.

By the time ASP.NET Core 3.0 is out and you want to migrate to it, you should switch to the health services introduced in ASP.NET Core 2.2.

General consensus about new features in minor versions (which replace or change previous behavior) is to support them for the current main version and drop the old functionality in the next major, ie the new [ApiController] attribute and automatic model validation was added in ASP.NET Core 2.1. By default, the 2.0 compatibility will be used and the new behavior won't be available unless you opt-in. Once 3.0 is released, the old features/behavior will be removed and only the new one will be used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM