Browse Source

Adding an example of a HttpMessageHandler's Lifetime to 5 minutes in the pool. The default lifetime of HttpMessageHandler instances in the pool is 2 minutes.

pull/632/head
Cesar De la Torre Llorente 6 years ago
parent
commit
8844aaba75
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/Web/WebMVC/Startup.cs

+ 4
- 1
src/Web/WebMVC/Startup.cs View File

@ -182,9 +182,12 @@ namespace Microsoft.eShopOnContainers.WebMVC
services.AddTransient<HttpClientAuthorizationDelegatingHandler>();
services.AddTransient<HttpClientRequestIdDelegatingHandler>();
//add http client servicse
services.AddHttpClient("extendedhandlerlifetime").SetHandlerLifetime(TimeSpan.FromMinutes(5));
//add http client services
services.AddHttpClient<IBasketService, BasketService>()
.AddHttpMessageHandler<HttpClientAuthorizationDelegatingHandler>()
.SetHandlerLifetime(TimeSpan.FromMinutes(5)) //Sample. Default lifetime is 2 minutes
.AddPolicyHandler(retriesWithExponentialBackoff)
.AddPolicyHandler(circuitBreaker);


Loading…
Cancel
Save