The Error
Runtime:
InvalidOperationException: Cannot resolve scoped service from root providerQuick Fix - 1 Min
1. DelegatingHandler registered as Singleton. Cannot inject Scoped. 2. Inject IServiceProvider and scope = provider.CreateScope(). 3. Or use AddHttpMessageHandler<T>() with Scoped lifetime.
Root Cause
HttpClientFactory creates handler once. Scoped services live per-request.
No comments yet. Be the first to share your thoughts!