I recently updated my visual studio from 2017 to 2019. I am using HttpClient implementation as Default. Everything wass working very well in vs2017. After i update my vs to 2019. Then when i am using httpClient, timeout and Cancelation Token don't work.
Here is my code:
var token = cts.Token;
using (var client = new HttpClient())
{
client.Timeout = TimeSpan.FromSeconds(20);
var response = await client.PostAsync("http://" + MyIp + ":9090/api/SqlAction/", new StringContent("my data", Encoding.UTF8, "application/json"), token);
if (response.IsSuccessStatusCode)
{
}
}