System.AggregateException: 'Some services are not able to be constructed
I stuck with this problem and don't understand how to fix it:
InvalidOperationException: Unable to resolve service for type 'BackForFront.Settings.FlightLegAggregatorSettings' while attempting to activate 'BackForFront.Services.FlightLegAggregator.FlightLegAggregatorApi'.
api:
how I register it:
3 Replies
If you want to use the configuration which is binded to a class (Options Pattern), you need to wrap the
FlightLegAggregatorSettings
in IOptions<FlightLegAggregatorSettings>
, instead of simply passing the class.
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-8.0#the-options-patternOptions pattern in ASP.NET Core
Discover how to use the options pattern to represent groups of related settings in ASP.NET Core apps.
So, instead of what you have replace your current api like this
ah, thanks!