AddHttpClient
AddHttpClient
services.AddHttpClient(client =>
{
client.BaseAddress = new Uri("https://jsonplaceholder.typicode.com/");
});
AddHttpClient
services.AddHttpClient()
.AddHttpMessageHandler()
.SetHandlerLifetime(TimeSpan.FromMinutes(5));
其中,TestClient 是实现 ITestClient 接口的类,TestMessageHandler 是实现 HttpMessageHandler 抽象类的类。AddHttpClient
上一篇:AddHttpClient<TClient>和AddHttpClient<TClient,TImplementation>的区别是什么?
下一篇:AddHttpClient<TClient>和AddHttpClient<TClient,TImplementation>的区别