Mid ASP.NET Core

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.

More from ASP.NET Core Tutorial

All questions for this course