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:
InvalidOperationException: Unable to resolve service for type 'BackForFront.Settings.FlightLegAggregatorSettings' while attempting to activate 'BackForFront.Services.FlightLegAggregator.FlightLegAggregatorApi'.
api:
public FlightLegAggregatorApi(
HttpClientFactory httpClientFactory,
CommonSettings commonSettings,
FlightLegAggregatorSettings flightLegAggregatorOptions) :
base(httpClientFactory, commonSettings.ContextHeaderName!)
{
this.createFlightLegEndpoint = flightLegAggregatorOptions.FlightLegCreateUri ?? throw new ArgumentNullException(nameof(flightLegAggregatorOptions));
this.updateFlightLegEndpoint = flightLegAggregatorOptions.FlightLegUpdateUri ?? throw new ArgumentNullException(nameof(flightLegAggregatorOptions));
} public FlightLegAggregatorApi(
HttpClientFactory httpClientFactory,
CommonSettings commonSettings,
FlightLegAggregatorSettings flightLegAggregatorOptions) :
base(httpClientFactory, commonSettings.ContextHeaderName!)
{
this.createFlightLegEndpoint = flightLegAggregatorOptions.FlightLegCreateUri ?? throw new ArgumentNullException(nameof(flightLegAggregatorOptions));
this.updateFlightLegEndpoint = flightLegAggregatorOptions.FlightLegUpdateUri ?? throw new ArgumentNullException(nameof(flightLegAggregatorOptions));
}how I register it:
public static IServiceCollection RegisterFlightLegCreationServices(this IServiceCollection services, IConfiguration configuration)
{
BindSettings<FlightLegAggregatorSettings>(services, configuration, "FlightLegAggregator");
BindSettings<SolverManagerSettings>(services, configuration, "SolverManager");
BindSettings<DmnSettings>(services, configuration, "Dmn");
BindSettings<ReadModelClientSettings>(services, configuration, "ReadModelClient");
services.AddTransient<HttpClientFactory>();
services.AddTransient<FlightLegAggregatorApiBase, FlightLegAggregatorApi>();
services.AddScoped<FlightLegAggregatorServiceBase, FlightLegAggregatorService>();
return services;
} public static IServiceCollection RegisterFlightLegCreationServices(this IServiceCollection services, IConfiguration configuration)
{
BindSettings<FlightLegAggregatorSettings>(services, configuration, "FlightLegAggregator");
BindSettings<SolverManagerSettings>(services, configuration, "SolverManager");
BindSettings<DmnSettings>(services, configuration, "Dmn");
BindSettings<ReadModelClientSettings>(services, configuration, "ReadModelClient");
services.AddTransient<HttpClientFactory>();
services.AddTransient<FlightLegAggregatorApiBase, FlightLegAggregatorApi>();
services.AddScoped<FlightLegAggregatorServiceBase, FlightLegAggregatorService>();
return services;
}