在ASP.Net Core中,如何使用Identity在开发环境中启动时登录帐户?
我试图通过ServiceProvider在Configure函数中获取SignInManager。
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope())
{
var signInManager = serviceScope.ServiceProvider.GetService<SignInManager<ApplicationUser>>();
signInManager.PasswordSignInAsync("user", "password", true, lockoutOnFailure: false).Wait();
}
...
但是dotnet在PasswordSignInAsync调用时崩溃了。