program.cs:
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("Default");
// Add services to the container.
builder.Services.AddDbContext<GerenciadorContext>(opts =>
{
opts.UseMySql(connectionString,ServerVersion.AutoDetect(connectionString));
});
builder.Services.AddIdentity<IdentityUser,IdentityRole>()
.AddEntityFrameworkStores<GerenciadorContext>();
builder.Services.AddTransient<IUserDao, UserDao>();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
As soon as I make a request it returns this error, I don't know if it's something in .NET 8

Please make sure to change the registration from
to
With this modification, your problem should be resolved.