Sal*_*ati 6 .net authentication identity asp.net-core-2.1
我已经将Identity包含到我的.NET Core2.1项目中,当我尝试构建项目时,它警告我以下错误:
找不到类型或命名空间名称'ApplicationUser'(您是否缺少using指令或程序集引用?)
我应该自己定义ApplicationUser还是Identity会自己创建它?
任何帮助,将不胜感激.
Rua*_*urg 16
您必须自己创建ApplicationUser类.默认用户是IdentityUser.ApplicationUser继承自IdentityUser:
public class ApplicationUser : IdentityUser
{
}
Run Code Online (Sandbox Code Playgroud)
但是,如果您没有扩展ApplicationUser,那么您也可以使用IdentityUser.所以不是这样的:
services.AddIdentity<ApplicationUser, IdentityRole>()
Run Code Online (Sandbox Code Playgroud)
你可以用这个:
services.AddIdentity<IdentityUser, IdentityRole>()
Run Code Online (Sandbox Code Playgroud)
并使用IdentityUser在项目的其余部分中替换ApplicationUser.
| 归档时间: |
|
| 查看次数: |
6117 次 |
| 最近记录: |