I have 2 hosted service and have to check each others health condition. How can i implement health check in C# Console Application (Hosted Service). what are the parameter to check the health of an Hosted Service.
If health checks via HTTP are an option for you I suggest to look into the built-in healt check functionality of .Net Core. It sets up a REST endpoint in your application where you can also implement a custom health check behaviour.
See: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-3.1
Technically you could than call the exposed health check API of one hosted service by the other.
You can add the health check endpoint to each of your hosted service. Each service will then be reachable why HTTP/REST and service A can call the health check API of service B and vice-versa.
E.g. service B then makes an http request to http://service-a-base-url/health and service A to http://service-b-base-url/health
If both services are running on the same host you can use port filtering so that each service health check endpoint listens on a different port. And you could also use localhost as host name in both cases with just a different port. See also this answer: https://stackoverflow.com/a/57906886/7730554
Note: If this is about monitoring your applications, I would suggest to consider a centralized monitoring approach by using some monitoring service rather than having your own applications doing health checks for monitoring purpose.