© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
31 replies
superbobface

❔ .net core 6 IConfiguration Injection

Hi there - i'm going nuts try to solve this simple problem. I have a .net Core 6 WebApplication builder based app, and all i'm trying to do is get to IConfiguration in my service classes.

From what i've read, .net 6 should automatically add its IConfiguration service to the build services, and therefore my AddService<MyClass> constructor whcih has public MyClass(IConfiguration configuration) in it throws "The service implementation object was not initialized or is not available." and it's not hitting breakpoints. Remove IConfiguration from teh constructor, it works

it's like either a) IConfiguration is not injected into the services for the app builder, or b) MyClass is not subject to being DI'd by asp.net.

argh
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ .NET CORE 6 services
C#CC# / help
4y ago
.NET CORE 6 MVC Threading
C#CC# / help
3y ago
❔ ASP.NET Core Environment Variables in Dependency Injection
C#CC# / help
3y ago
Unit Testing Classes with Dependency Injection (ASP.NET Core)
C#CC# / help
3y ago