1

我试图使用IdentityServer4与ASP.NET样板模块零,但我得到了一些错误集成ASP.NET样板模块与IdentityServer4

我想请点击此链接 http://docs.identityserver.io/en/release/quickstarts/6_aspnet_identity.html

我ConfigureServices功能

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") 
      ); 
     }); 

    } 

我的配置功能

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?}"); 
     }); 
    } 

和运行程序后,我得到这个错误

“Microsoft.AspNetCore.Identity.UserManager1 [EventoTix.Users.User, EventoTix.Core,版本= 1.0.0.0,文化=中性, 公钥=空]] _ b66a8aa6-a49b-47c6-A3B3-d6e943ee4c47' 正在等待以下依赖性 : - 服务“Microsoft.AspNetCore.Identity.IUserStore1 [[EventoTix.Users.User, EventoTix.Core,版= 1.0.0.0,文化=中立, PublicKeyToken = null]]'这是未注册。

回答

1

我得到的答案从哈利勒·易卜拉欣卡尔坎

他说模块零模板使用EF 6.x,而不是EF Core。此外,Abp.Zero软件包基于Identity 2.x,而不是Identity Core。所以,它们不兼容。

参考: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/961

+0

目前已经取得了在此期间取得了一些进展同样的错误,在这个意义上,集成Identity Server的实例4工作。但是也可以支持外部独立实例(服务器),这样也可以。 –

0

尝试的NuGet管理器安装 https://www.nuget.org/packages/Microsoft.AspNetCore.Identity/

如果没有帮助,接近解决方案,找到解决方案文件夹,包文件夹,再删除都在那里,打开U解决方案,去NuGet包管理器,然后单击“还原”

+0

我这样做,但还是收到 –