Base solution for your next web application
Open Closed

UserManager Dependencies error #3942


User avatar
0
chehrhard created

Hello

I'll facing a problem and i can't find the answer. I use a brand new NetCore/Angular that works fine. I add a WPF for prototyping (i'll already done this whith v 2.3 and it works fine) but raises exceptions as i access to ABp Code.

Here is what i have :

L'exception Castle.MicroKernel.Handlers.HandlerException s'est produite HResult=0x80131500 Message=Can't create component 'K2.Stratos.Authorization.Users.UserManager' as it has dependencies to be satisfied.

'K2.Stratos.Authorization.Users.UserManager' is waiting for the following dependencies:

  • Service 'Microsoft.Extensions.Options.IOptions`1[[Microsoft.AspNetCore.Identity.IdentityOptions, Microsoft.Extensions.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
  • Service 'Microsoft.AspNetCore.Identity.IPasswordHasher`1[[K2.Stratos.Authorization.Users.User, K2.Stratos.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
  • Service 'System.Collections.Generic.IEnumerable1[[Microsoft.AspNetCore.Identity.IUserValidator1[[K2.Stratos.Authorization.Users.User, K2.Stratos.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Extensions.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
  • Service 'System.Collections.Generic.IEnumerable1[[Microsoft.AspNetCore.Identity.IPasswordValidator1[[K2.Stratos.Authorization.Users.User, K2.Stratos.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Extensions.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
  • Service 'Microsoft.AspNetCore.Identity.ILookupNormalizer' which was not registered.
  • Service 'Microsoft.AspNetCore.Identity.IdentityErrorDescriber' which was not registered.
  • Service 'System.IServiceProvider' which was not registered.
  • Service 'Microsoft.Extensions.Logging.ILogger`1[[K2.Stratos.Authorization.Users.UserManager, K2.Stratos.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
  • Service 'K2.Stratos.Authorization.Roles.RoleManager' which was registered but is also waiting for dependencies. 'K2.Stratos.Authorization.Roles.RoleManager' is waiting for the following dependencies:
  • Service 'System.Collections.Generic.IEnumerable1[[Microsoft.AspNetCore.Identity.IRoleValidator1[[K2.Stratos.Authorization.Roles.Role, K2.Stratos.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Extensions.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
  • Service 'Microsoft.AspNetCore.Identity.ILookupNormalizer' which was not registered.
  • Service 'Microsoft.AspNetCore.Identity.IdentityErrorDescriber' which was not registered.
  • Service 'Microsoft.Extensions.Logging.ILogger`1[[K2.Stratos.Authorization.Roles.RoleManager, K2.Stratos.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

I boostraped the app with this code public App() {

        _bootstrapper = AbpBootstrapper.Create<ProtoModule>();
        //_bootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(f => f.UseAbpLog4Net()
        //    .WithConfig("log4net.config"));
    }

    protected override async void OnStartup(StartupEventArgs e)
    {
        _bootstrapper.Initialize();
      //  await Proto.CurrentWebServer.ConnectAsync();

    }

    protected override void OnExit(ExitEventArgs e)
    {
        _bootstrapper.Dispose();
    }

can you help me ?

Chris


11 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Check that you called RegisterAssemblyByConvention:

    [DependsOn(typeof(ProtoDataModule), typeof(ProtoApplicationModule))]
    public class ProtoModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
    
  • User Avatar
    0
    chehrhard created

    Yes i did it like this ... I re-checked all but no luck ...

    [DependsOn(
            typeof(StratosEntityFrameworkCoreModule),
            typeof(StratosApplicationModule),
            typeof(SellsyModule),
            typeof(FreshServiceModule),
            typeof(StratosApplicationModule),
            typeof(StratosCoreModule))]
        public class ProtoModule : K2Module
        {
            public override void PreInitialize()
            {
                //Configuration.DefaultNameOrConnectionString = "Default";
                IocManager.Register<IAbpSession, ProtoClaimSession>();
                IocManager.Register<IStratosServer, StratosWebServer>();
              
            }
    
            public override void Initialize()
            {
                IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
            }
        }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ChEhrhard,

    I think your problem is similar to <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues/376">https://github.com/aspnetboilerplate/mo ... issues/376</a>, can you check that ?

  • User Avatar
    0
    chehrhard created

    I tried but have an error :

    Méthode introuvable : 'Castle.MicroKernel.Registration.ComponentRegistration1<!0> Castle.MicroKernel.Registration.ComponentRegistration1.UsingFactoryMethod(System.Converter`2<Castle.MicroKernel.IKernel,!!0>, Boolean)'.

    here's where i put the code ( i tried before and after then IoCManager.RegisterAsse....... line.

    [DependsOn(
            typeof(StratosEntityFrameworkCoreModule),
            typeof(StratosApplicationModule),
            typeof(SellsyModule),
            typeof(FreshServiceModule),
            typeof(StratosApplicationModule),
            typeof(StratosCoreModule))]
        public class ProtoModule : K2Module
        {
            public override void PreInitialize()
            {
                //Configuration.DefaultNameOrConnectionString = "Default";
                IocManager.Register&lt;IAbpSession, ProtoClaimSession&gt;();
                IocManager.Register&lt;IStratosServer, StratosWebServer&gt;();
              
            }
    
            public override void Initialize()
            {
                IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
    
                var services = new ServiceCollection();
                IdentityRegistrar.Register(services);
                WindsorRegistrationHelper.CreateServiceProvider(IocManager.IocContainer, services);
            }
        }
    
  • User Avatar
    0
    aaron created
    Support Team

    Can you show the full stack trace?

  • User Avatar
    0
    chehrhard created

    Here you have

    à Castle.Windsor.MsDependencyInjection.WindsorRegistrationHelper.RegisterServiceDescriptor(IWindsorContainer container, ServiceDescriptor serviceDescriptor) à Castle.Windsor.MsDependencyInjection.WindsorRegistrationHelper.CreateServiceProvider(IWindsorContainer container, IServiceCollection services) à K2.Stratos.Wpf.Logic.ProtoModule.Initialize() dans C:\EhciDev\K2\Stratos\test\K2.Stratos.Wpf\Logic\ProtoModule.cs:ligne 39 à Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_1(AbpModuleInfo module) à System.Collections.Generic.List1.ForEach(Action1 action) à Abp.Modules.AbpModuleManager.StartModules() à Abp.AbpBootstrapper.Initialize()

  • User Avatar
    0
    aaron created
    Support Team

    ComponentRegistration.UsingFactoryMethod was modified in Castle.Windsor v4.0.0 and WindsorRegistrationHelper.cs is interpreted as passing in a Converter instead of Func. This might have to be fixed on Volosoft's side, so hang on.

  • User Avatar
    0
    chehrhard created

    ok thanks for the answer. I hang on .. any idea of a timing ?

    is there a workaround in the meantime ?

  • User Avatar
    0
    aaron created
    Support Team

    Can you check that you are using v2.1.1/v3.0.0 of Castle.Windsor.MsDependencyInjection nuget package?

  • User Avatar
    0
    chehrhard created

    I use v3.0 .

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ChEhrhard,

    Which version of Castle.Core and Castle.Windsor do you use in your project ? If your project does not contain confidential information, you can send your project to us and let us check it.

    Thanks.