How scoped services behave in background tasks vs request scope?
- Scoped services are tied to the HTTP request lifecycle.
- In background tasks, you must manually create a scope using
IServiceScopeFactory to resolve scoped services safely.
IServiceScopeFactory to resolve scoped services safely.