ConfigureHttpClient not firing #16314
Unanswered
alin-devnet
asked this question in
Q&A
Replies: 1 comment
-
This isn't really a bug. Due to the multi-tenant nature of OC yes, services by default are specific to tenants. However, you can register services for the whole app too, but with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Orchard Core version
1.8.x
To Reproduce
When adding a http client binding, the ConfigureHttpClient is not firing.
services.AddHttpClient<IService, Service>() .**ConfigureHttpClient**(c => c.BaseAddress = new Uri("test-uri"));
This seems to work fine if the binding is added in ConfigureServices.
builder.Services .AddOrchardCore() .WithTenants() .ConfigureServices((m, serviceProvider) => { services.AddHttpClient<IService, Service>() .**ConfigureHttpClient**(c => c.BaseAddress = new Uri("test-uri")); });
Whilst the above works, my understanding is that each tenant will have it's own HttpClient instance injected and considering each tenant will call the same API, it might end up not using resources optimally (thinking about snat ports here).
Beta Was this translation helpful? Give feedback.
All reactions