4
Hello, I’m having doubts on how to make fun simultaneous calls (about 100) in a REST service.
The example of code I have is the following:
using (var http = new HttpClient { BaseAddress = new Uri("some url") })
{
using (var httpContent = new StringContent(json, Encoding.Default, "application/json"))
{
using (var response = await http.PostAsync("/services/send", httpContent))
{
}
}
}
I wonder if to do this I need to use await
and async
or if the class httpClient
already has something by default, and if it is possible to make only one connection and send several requests within the same connection.
This should answer: https://msdn.microsoft.com/en-us/library/hh696703(v=vs.110). aspx :)
– Guilherme Nascimento