Answer the question
In order to leave comments, you need to log in
How to fix System.AggregateException: "Some services are not able to be constructed"?
Hello
Problem in brief:
I use GenericRepository for access to a DB. Also in the project there are various services that require a GenericRepository object in the constructor to work.
In the error output, it says that the error generally occurred in DependencyInjection.dll
Knocks out immediately at startup in general in Main'a There is
no error if you remove GenericRepository from the service constructor
Maybe I registered it incorrectly in Startup.css (Code below) ?
services.AddScoped(typeof(IGenericRepository<>), typeof(GenericRepository<>));
Answer the question
In order to leave comments, you need to log in
Solution: The problem can occur if another class where you are trying to get an object via DI uses a class instead of an interface.
Also, an error can occur if the service class is simply not registered in the pipeline
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question