services.ConfigureMongoDbIdentity<ApplicationUser, ApplicationRole, Guid>(new MongoDbIdentityConfiguration {
MongoDbSettings = new MongoDbSettings {
ConnectionString = this._configuration.GetConnectionString("DatabaseConnectionString"),
DatabaseName = "DatabaseName"
},
IdentityOptionsAction = options => {
// ApplicationUser settings
options.User.RequireUniqueEmail = true;
}
});
services.AddScoped<IAppUserManager, AppUserManager>();
public AppUserManager(IConfiguration configuration, ILogger<AppUserManager> logger,
UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager,
IMapper mapper) {
this._configuration = configuration;
this._logger = logger;
this._userManager = userManager;
this._signInManager = signInManager;
this._mapper = mapper;
}
Unhandled exception. System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: TokenTracker.TokenTracker.Core.User.IAppUserManager Lifetime: Scoped ImplementationType: TokenTracker.Token
Tracker.Core.User.AppUserManager': Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager`1[TokenTracker.TokenTracker.Core.User.ApplicationUser]' while attempting to activate 'TokenTracker.TokenTracker.Core.User.AppUserManager'.)
---> System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: TokenTracker.TokenTracker.Core.User.IAppUserManager Lifetime: Scoped ImplementationType: TokenTracker.TokenTracker.Core.User.AppUserManager': Unable to resolve s
ervice for type 'Microsoft.AspNetCore.Identity.SignInManager`1[TokenTracker.TokenTracker.Core.User.ApplicationUser]' while attempting to activate 'TokenTracker.TokenTracker.Core.User.AppUserManager'.
---> System.InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager`1[TokenTracker.TokenTracker.Core.User.ApplicationUser]' while attempting to activate 'TokenTracker.TokenTracker.Core.User.AppUserManager'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(ServiceDescriptor serviceDescriptor, CallSiteChain callSiteChain)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.ValidateService(ServiceDescriptor descriptor)
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable`1 serviceDescriptors, IServiceProviderEngine engine, ServiceProviderOptions options)
--- End of inner exception stack trace ---
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable`1 serviceDescriptors, IServiceProviderEngine engine, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder)
at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at GetChain.Program.Main(String[] args) in C:\Users\icond\Documents\Coding\.NET Projects\GetChain\GetChain\Program.cs:line 7
I can however use version 2.1.1 with no issues.