help
Root Question Message
System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: StatsByAlfaLaval.Application.Services.TextService.ITextService Lifetime: Scoped ImplementationType: StatsByAlfaLaval.Application.Services.TextService.TextService': Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate 'StatsByAlfaLaval.Application.Services.TextService.TextService'
public static IServiceCollection AddApplication(this IServiceCollection services)
{
services.AddScoped<IAuthenticationService, AuthenticationService>();
services.AddScoped<ITextService, TextService>();
return services;
}
var builder = WebApplication.CreateBuilder(args);
{
builder.Services
.AddApplication()
.AddInfrastructure();
builder.Services.AddControllers();
}
public class TextService : ITextService
{
private readonly HttpClient _httpClient;
public TextService(HttpClient httpClient)
{
_httpClient = httpClient;
}
private readonly HttpClient _httpClient;
public TextService(IHttpClientFactory httpClient)
{
_httpClient = httpClient.CreateClient();
}