Implementing advanced features
Now that you have seen the fundamentals of building a web service and then calling it from a client, let us look at some more advanced features.
Implementing a Health Check API
There are many paid services that perform site availability tests that are basic pings, some with more advanced analysis of the HTTP response.
ASP.NET Core 2.2 and later makes it easy to implement more detailed website health checks. For example, your website might be live, but is it ready? Can it retrieve data from its database?
- Open
NorthwindService.csproj
. - In the
<ItemGroup>
for the Swashbuckle package, add a project reference to enable Entity Framework Core database health checks, as shown in the following markup:<PackageReference Include= "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="5.0.0" />
- In TERMINAL, restore packages and compile the website project...