'IApplicationBuilder does not includes a definition for UseHealthChecks

As suggested at the tutorial for kubernetes health check I like to implement the health chack at my .NET Core WebApi at class startup.cs at method Configure. But the method .UseHealthCheck() is unknown. I don't know what creates this problem. I guess all usings are there?!? enter image description here

        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        app.UseHealthChecks("/health");
        app.Run(async (context) =>
        {
            await context.Response.WriteAsync(
                "Navigate to /health to see the health status.");
        });

here the using:

    using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Identity.Client;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Protocols;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;

How to fix this problem?

Thanks for your help! Frank



Solution 1:[1]

Thanks mxmissile! I add the NuGet package

Microsoft.AspNetCore.Diagnostics.HealthChecks 2.2.0

and there for also and first

Microsoft.AspNetCore.Http.Features 2.2.0
Microsoft.AspNetCore.Http.Abstractions 2.2.0
Microsoft.Net.Http.headers 2.2.0

Now the method is known.

Solution 2:[2]

I've found you only need to install these two

Microsoft.AspNetCore.Diagnostics.HealthChecks 2.2.0
Microsoft.Extensions.Diagnostics.HealthChecks 2.2.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frank Mehlhop
Solution 2 Emma Wilby