[英]ASP.NET IserviceCollection AddIdentity not found
I have a situation where I want to change the password length of ASP.NET Identity user (database-first) to lets say 4. After much research, I found I can do it from the start up class with:我有一种情况,我想将 ASP.NET 身份用户(数据库优先)的密码长度更改为 4。经过大量研究,我发现我可以从 class 开始使用:
public void ConfigureServices(IServiceCollection services)
{
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
{
options.Password.RequireDigit = false;
options.Password.RequiredLength = 4;
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
}
I have downloaded the packages Microsoft.Framework.DependencyInjection
and Microsoft.Extensions.DependencyInjection
but still AddIdentity cannot be found我已经下载了
Microsoft.Framework.DependencyInjection
和Microsoft.Extensions.DependencyInjection
包,但仍然找不到 AddIdentity
AddIdentity
and it's related extension methods are part of ASP.NET Core Identity, which resides on the NuGet package Microsoft.AspNetCore.Identity
. AddIdentity
及其相关扩展方法是 ASP.NET Core Identity 的一部分,它位于 NuGet 包Microsoft.AspNetCore.Identity
。
AddEntityFrameworkStores
is part of EntityFrameworkCore for ASP.NET Core Identity package Microsoft.AspNetCore.Identity.EntityFrameworkCore
AddEntityFrameworkStores
是 EntityFrameworkCore for ASP.NET Core 标识包Microsoft.AspNetCore.Identity.EntityFrameworkCore
你需要添加这个对我Miscroft.AspNetCore.Identity.UI
金块包Miscroft.AspNetCore.Identity.UI
Also you have to make sure you pick the right version for both.此外,您还必须确保为两者选择正确的版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.