我按照共享链接上的教程安装了 Identity Manager ( https://www.scottbrady91.com/ASPNET-Identity/Identity-Manager-using-ASPNET-Identity )。我的 localhost 项目还没有 SSL,需要一种方法来绕过当我运行项目时弹出的“需要 HTTPS”消息。我在想下面的 Startup 类可能是我需要做某事的地方,但不确定。我还尝试在 Visual Studios 中查找设置,并在 IIS 中四处寻找解决此问题的方法,但没有运气。
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
var factory = new IdentityManagerServiceFactory();
factory.IdentityManagerService =
new Registration<IIdentityManagerService>(Create());
app.UseIdentityManager(new IdentityManagerOptions { Factory = factory });
}
private IIdentityManagerService Create()
{
var context =
new IdentityDbContext(
@"Data Source=.\SQLEXPRESS;Initial Catalog=AspIdentity;Integrated Security=false");
var userStore = new UserStore<IdentityUser>(context);
var userManager = new UserManager<IdentityUser>(userStore);
var roleStore = new RoleStore<IdentityRole>(context);
var roleManager = new RoleManager<IdentityRole>(roleStore);
var managerService =
new AspNetIdentityManagerService<IdentityUser, string, IdentityRole, string>
(userManager, roleManager);
return managerService;
}
}