1

I'm trying to use IdentityServer4 with ASP.NET Boilerplate Module zero but i'm getting some errors

I'm trying to follow this link http://docs.identityserver.io/en/release/quickstarts/6_aspnet_identity.html

My ConfigureServices function

public IServiceProvider ConfigureServices(IServiceCollection services)
    {
        var connectionString = @"Server=localhost\SQLEXPRESS; Database=MyDb;User Id=sa; password=sa;";

        // configure identity server with in-memory users, but EF stores for clients and resources
        var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
        services.AddIdentityServer()
           .AddTemporarySigningCredential()
           .AddConfigurationStore(builder =>
               builder.UseSqlServer(connectionString, options =>
                   options.MigrationsAssembly(migrationsAssembly)))
           .AddOperationalStore(builder =>
               builder.UseSqlServer(connectionString, options =>
                   options.MigrationsAssembly(migrationsAssembly)))
                   .AddAspNetIdentity<User>();

        //MVC
        services.AddMvc(options =>
        {
            options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
        });

        services.AddIdentity<User, Role>();


        //Configure Abp and Dependency Injection
        return services.AddAbp<EventoTixWebModule>(options =>
        {
            //Configure Log4Net logging
            options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                f => f.UseAbpLog4Net().WithConfig("log4net.config")
            );
        });

    }

My configure function

public void Configure(IApplicationBuilder app, IHostingEnvironment env,         ILoggerFactory loggerFactory)
    {
        // this will do the initial DB population
        InitializeDatabase(app);

        //loggerFactory.AddConsole(Configuration.GetSection("Logging"));
        //loggerFactory.AddDebug();
        app.UseAbp(); //Initializes ABP framework.

        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            //app.UseDatabaseErrorPage();
            app.UseBrowserLink();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
        }

        app.UseStaticFiles();

        //Integrate to OWIN
        app.UseAppBuilder(ConfigureOwinServices);

        //app.UseIdentity();
        app.UseIdentityServer();


        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });
    }

and after running the application i'm getting this error

'Microsoft.AspNetCore.Identity.UserManager1[[EventoTix.Users.User, EventoTix.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]_b66a8aa6-a49b-47c6-a3b3-d6e943ee4c47' is waiting for the following dependencies: - Service 'Microsoft.AspNetCore.Identity.IUserStore1[[EventoTix.Users.User, EventoTix.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

Sanket
  • 19,295
  • 10
  • 71
  • 82

2 Answers2

1

I got the answer from Halil İbrahim Kalkan

He says Module zero template uses EF 6.x, not EF Core. Also, Abp.Zero package is based on Identity 2.x, not to Identity Core. So, they are not compatible.

Reference: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/961

  • There has been made some progress in the meantime, in the sense that an integrated Identity Server 4 instance works. But it would be fine to have also an external stand-alone instance (server) supported as well. – Matthias Dieter Wallnöfer Jun 29 '17 at 14:51
0

try to install https://www.nuget.org/packages/Microsoft.AspNetCore.Identity/ in nuget manager.

If not help, close solution, find solution folder, package folder, delete all there, open u solution again, go to nuget package manager and click "restore"