private readonly IHttpClientFactory _iHttpClientFactory;
public static NetHelper Get = new NetHelper();
public NetHelper()
{
var serviceCollection = new ServiceCollection();
serviceCollection.AddHttpClient();
var service = serviceCollection.BuildServiceProvider();
_iHttpClientFactory = service.GetService<IHttpClientFactory>();
}
原文:https://www.cnblogs.com/yibinboy/p/10493268.html