You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I tried to re-create this to dotnet core 6 for my project, I believe nothing wrong with my code becuase I tried to copy and paste and modify one by one. but when I try for register, _userManager is null
Expected behavior _userManager in AccountService is populated or not null
Screenshots
Desktop (please complete the following information):
OS: Mac
Browser Chrome
Additional context
this is my program.cs in web api
usingApplication;usingApplication.Interfaces;usingInfrastructure.Identity;usingInfrastructure.Persistence;usingInfrastructure.Identity.Models;usingMicrosoft.AspNetCore.Identity;usingMicrosoft.AspNetCore.Mvc;usingReadbuk.Api.Services;varbuilder=WebApplication.CreateBuilder(args);builder.Services.AddApplication();builder.Services.AddIdentityInfrastructure(builder.Configuration);builder.Services.AddPersistenceInfrastructure(builder.Configuration);// Add services to the container.builder.Services.AddControllers();// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbucklebuilder.Services.AddEndpointsApiExplorer();builder.Services.AddSwaggerGen();builder.Services.AddScoped<IAuthenticatedUserService,AuthenticatedUserService>();
#region API Versioning
// Add API Versioning to the Projectbuilder.Services.AddApiVersioning(config =>{// Specify the default API Version as 1.0config.DefaultApiVersion=newApiVersion(1,0);// If the client hasn't specified the API version in the request, use the default API version number config.AssumeDefaultVersionWhenUnspecified=true;// Advertise the API versions supported for the particular endpointconfig.ReportApiVersions=true;});
#endregion
varapp=builder.Build();// Configure the HTTP request pipeline.if(app.Environment.IsDevelopment()){app.UseSwagger();app.UseSwaggerUI();varscopeFactory=app.Services.GetRequiredService<IServiceScopeFactory>();using(varscope=scopeFactory.CreateScope()){varroleManager=scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>();varuserManager=scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();//await DefaultRoles.SeedAsync(userManager, roleManager);//await DefaultBasicUser.SeedAsync(userManager, roleManager);//await DefaultSuperAdmin.SeedAsync(userManager, roleManager);}}app.UseHttpsRedirection();app.UseAuthorization();app.MapControllers();app.Run();
The text was updated successfully, but these errors were encountered:
Describe the bug
I tried to re-create this to dotnet core 6 for my project, I believe nothing wrong with my code becuase I tried to copy and paste and modify one by one. but when I try for register,
_userManager
is nullExpected behavior
_userManager
inAccountService
is populated or not nullScreenshots
Desktop (please complete the following information):
Additional context
this is my program.cs in web api
The text was updated successfully, but these errors were encountered: