-
-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
What is the LightInject equivalent for the recommened registration of HttpClients:
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
IServiceCollection services = builder.Services;
services.AddHttpClient("my-client")
.AddStandardResilienceHandler(options =>
{
// Configure standard resilience options here
});
And the resolve:
// Use the client
var host = builder.Build();
var httpClient = host.Services
.GetRequiredService<IHttpClientFactory>()
.CreateClient("my-client");
Source: https://devblogs.microsoft.com/dotnet/building-resilient-cloud-services-with-dotnet-8/#tl;dr
Thanks
Metadata
Metadata
Assignees
Labels
No labels