我试图使用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]]'这是未注册。
目前已经取得了在此期间取得了一些进展同样的错误,在这个意义上,集成Identity Server的实例4工作。但是也可以支持外部独立实例(服务器),这样也可以。 –