简体   繁体   English

ASP.NET 找不到 IserviceCollection AddIdentity

[英]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.DependencyInjectionMicrosoft.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.

相关问题 在 ASP.NET MVC 中使用 ASP.NET Core IServiceCollection - Using ASP.NET Core IServiceCollection in ASP.NET MVC IServiceCollection.AddFacebookAuthentication - 没有定义,也没有找到尝试在 asp.net 核心中添加 facebook 身份验证的方法 - IServiceCollection.AddFacebookAuthentication - no definition and no method found trying to add facebook authentication in asp.net core “IServiceCollection”不包含“AddIdentity”的定义 - 'IServiceCollection' does not contain a definition for 'AddIdentity' IServiceCollection 服务的 Asp.Net Core 5.0 问题 - Asp.Net Core 5.0 Issue with IServiceCollection services 使用Unity而不是ASP.Net Core DI IServiceCollection - Using Unity instead of ASP.Net Core DI IServiceCollection asp.net core - 使用 IServiceCollection 扩展中的选项添加服务 - asp.net core - AddService using options iniside IServiceCollection extension 如何在ASP.NET Core中将自定义TUser和TRole添加到services.AddIdentity? - How to add custom TUser and TRole into services.AddIdentity in ASP.NET Core? ASP.Net 5:将1.0 Beta8更新到RC1-IServiceCollection不包含AddMvc的定义 - ASP.Net 5: Updating 1.0 Beta8 to RC1 - IServiceCollection does not contain definition for AddMvc Autofac ASP.NET 核心多租户:无法在每个租户的 ContainerBuilder 上调用 IServiceCollection 扩展 - Autofac ASP.NET Core Multitenant: Can't call IServiceCollection extensions on per-tenant ContainerBuilder “IServiceCollection”不包含“AddAWSService”的定义,并且在asp.net core 2.2 中没有可访问的扩展方法“AddAWSService”错误? - 'IServiceCollection' does not contain a definition for 'AddAWSService' and no accessible extension method 'AddAWSService' error in asp.net core 2.2?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM