I need to send few requests to specific URL every 5 minutes from web service methods. I tried using HttpClient, HttpWebRequest and RestClient, but all sockets are exhausted after hour or two.
Can you suggest me what is the right way to send few requests to some URL every 5 minutes without all sockets to be exhausted? Thank you in advance for any help.
Sample of the code
private static HttpClient client = new HttpClient(); public async Task sendReq() { client.DefaultRequestHeaders.ConnectionClose = true; var res = await client.GetStringAsync(url); }
2.1m questions
2.1m answers
60 comments
57.0k users