healthchecks_healthchecks/templates/docs/csharp.md
2022-04-25 21:14:35 +03:00

361 B

C#

Below is an example of making an HTTP request to SITE_NAME from C#.

try
{
    using (var client = new System.Net.Http.HttpClient())
    {
        client.Timeout = System.TimeSpan.FromSeconds(10);
        client.GetAsync("PING_URL").Wait();
    }
}
catch (System.Exception ex)
{
    System.Console.WriteLine($"Ping failed: {ex.Message}");
}