How can I check health for Background worker solution?
I created a background working service solution that uses
var builder = Host.CreateApplicationBuilder(args);
as a looked it up since it is a hosting programme it cannot have url in traditional way as we have in web apis thus i can't check health. What can I do? whats the best practice in that situation?
3 Replies
It might be easier if you are on .NET Aspire, https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/health-checks People discussed about that in threads like https://github.com/dotnet/aspire/issues/2927
>whats the best practice in that situation?
To add a web server.
Aspire requires you to add a web server. And doesn't solve the user's question, which isn't how to host it: it's how to health check it in a host.
@Dachi docker healthchecks?
The check can be any command, so you could do something like write out a file.
Then have the healthcheck inspect the contents of the file.