.NET 8 “Some services are not able to be constructed” Error
ERROR:
System.AggregateException
HResult=0x80131500
Message=Some services are not able to be constructed (Error while validating the service descriptor ‘ServiceType: BookACar.Application.Interfaces.CarInterfaces.ICarRepository Lifetime: Scoped ImplementationType: CarRepository’: Implementation type ‘CarRepository’ can’t be converted to service type ‘BookACar.Application.Interfaces.CarInterfaces.ICarRepository’) (Error while validating the service descriptor ‘ServiceType: BookACar.Application.Features.CQRS.Handlers.CarHandlres.GetCarWithBrandQueryHandler Lifetime: Scoped ImplementationType: BookACar.Application.Features.CQRS.Handlers.CarHandlres.GetCarWithBrandQueryHandler’: Implementation type ‘CarRepository’ can’t be converted to service type ‘BookACar.Application.Interfaces.CarInterfaces.ICarRepository’)
Source=Microsoft.Extensions.DependencyInjection
StackTrace:
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
at Microsoft.Extensions.Hosting.HostApplicationBuilder.Build()
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
at Program.<Main>$(String[] args) in C:ProjectsCarBookPresentationBookACar.WebApiProgram.cs:line 51