HttpClient 是支持重入的

代码如下

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = new HttpClient();
            var t1 = x.GetAsync("http://www.baidu.com");
            var t2 = x.GetAsync("http://www.zhihu.com");
            Task.WaitAll(t1, t2);
            Console.WriteLine(t1.Result.StatusCode);
            Console.WriteLine(t2.Result.StatusCode);
        }
    }
}

运行结果如下

OK
OK
请按任意键继续. . .

测试

TOC

H1

H1

H2

H3

H2

测试文本

`test inline`

Namespace MyNamespace
	Friend Class MyClass
		Public Sub New()
			'Do Nothing
		End Sub
	End Class
End Namespace

 

Content is available under CC BY-SA 3.0 unless otherwise noted.