Coming across very outdated information on graceful shutdown of the asp.net core application, can someone fill in with the updated info.
Usecase: I'd like to unregister with consul on application exit.
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((host, config) =>
{
})
.UseStartup<Service>();
For capturing graceful shutdown, you could try
IHostApplicationLifetime.A demo: