rehansaeed.github.io
rehansaeed.github.io copied to clipboard
[Comment] Optimally Configuring ASP.NET Core HttpClientFactory
https://rehansaeed.com/optimally-configuring-asp-net-core-httpclientfactory/
Frank Alvarez commented on 2018-08-31 02:33:45
Where Nice article, but where are you using IHttpClientFactory? Shouldn't RocketClient be injecting IHttpClientFactory instead of HttpClient?
Thanks
Muhammad Rehan Saeed commented on 2018-08-31 09:27:56
Where Nice article, but where are you using
IHttpClientFactory? Shouldn'tRocketClientbe injectingIHttpClientFactoryinstead ofHttpClient?Thanks
IHttpClientFactory is kind of hidden away from you, you don't need to deal with it. You only need to provide some configuration for it and then consume the HttpClient it produces which gets injected into your typed client. This makes it much easier to use.
Stan commented on 2018-08-31 11:24:09
Great article, thank you! Would it make sense to add a 3rd DelegatingHandler, to give the Receiver a way to detect the retries from the Polly policies? Something along the lines of this.
James commented on 2018-09-04 11:38:59
Thank you for the post, very informative, could you recommend a way that we could add a RefreshTokenDelegateHandler to the registration which could be configured per typed client?
Muhammad Rehan Saeed commented on 2018-09-21 09:44:28
Great article, thank you! Would it make sense to add a 3rd
DelegatingHandler, to give the Receiver a way to detect the retries from the Polly policies? Something along the lines of this.
X-Correlation-ID and X-Request-ID are the same thing, just different names because there is no standard.
Muhammad Rehan Saeed commented on 2018-09-21 09:46:09
Thank you for the post, very informative, could you recommend a way that we could add a
RefreshTokenDelegateHandlerto the registration which could be configured per typed client?
Yes, using a delegate handler for that purpose is the right way to go. I'm not aware of any libraries that provide that for you, IdentityServer4 might have something if you search for it.
DFT commented on 2019-02-09 03:28:20
Thanks, I'm using Polly as a Nuget package with very similar settings and cases. What's the approach here? (Taking into account the maturity and the other several policies offered by Polly).
Ritesh Koul commented on 2019-06-20 19:17:39
Hey Rehan one question how can we create sync policy in Polly for synchronous call to Webapi? Or what would be the right solution to create Polly policy where there is synchronous call to web api?
Muhammad Rehan Saeed commented on 2019-06-21 09:15:10
Hey Rehan one question how can we create sync policy in Polly for synchronous call to Webapi? Or what would be the right solution to create Polly policy where there is synchronous call to web api?
Avoid using sync API's. It doesn't make sense to do so when making HTTP requests.
David I commented on 2019-11-18 20:25:45
Hi Rehan, great article. I've followed your example and on the first call everything works fine, but if I make a second call I'm finding that I run a Cannot access a disposed object. ObjectDisposed_ObjectName_Name exception when the this line is called in the SendAsync function in CorrelationIdDelegatingHandler:
return base.SendAsync(request, cancellationToken);
I'm using ASP.NET Core 2.2, but not sure what I'm missing here?
Muhammad Rehan Saeed commented on 2019-11-29 17:47:02
Hi Rehan, great article. I've followed your example and on the first call everything works fine, but if I make a second call I'm finding that I run a
Cannot access a disposed object. ObjectDisposed_ObjectName_Nameexception when the this line is called in theSendAsyncfunction inCorrelationIdDelegatingHandler:return base.SendAsync(request, cancellationToken);I'm using ASP.NET Core 2.2, but not sure what I'm missing here?
Sounds like you are reusing a disposed resource. Figure out what the resource is and either stop disposing it the second time or create a new one each time. You probably have the IoC lifetime setup incorrectly.