How do you register services in the ASP.NET Core DI container?
Loading
How do you register services in the ASP.NET Core DI container?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
William GramPosted Jul 2, 2025, 9:05 AM
Use
services AddSingleton<>AddScoped<>orAddTransient<>in theConfigureServicesmethod ofStartup.cs.Jack AbroyPosted Jul 2, 2025, 8:37 AM
Use
services.AddSingletonAddScopedorAddTransientinStartup csorProgram.cs.Rajanikant HawaldarPosted Jul 2, 2025, 6:06 AM
Can you check this
https://www.c-sharpcorner.com/article/getting-started-with-dependency-injection-in-asp-net-core-using-c-sharp/