正如标题所说的那样。
普通http的例子:
var c = new HttpClient
{
BaseAddress = new Uri("http://www.google.com.br")
};
var l = new List<Task<HttpResponseMessage>>();
for (int i = 0; i < 5; i++)
{
l.Add(c.GetAsync(""));
}
await Task.WhenAll(l);
https的例子:
var c = new HttpClient
{
BaseAddress = new Uri("https://www.google.com.br")
};
var l = new List<Task<HttpResponseMessage>>();
for (int i = 0; i < 5; i++)
{
l.Add(c.GetAsync(""));
}
await Task.WhenAll(l);
结果: