我需要一些有关 ASP.NET Core 项目的帮助。
我需要连接的用户来创建一个对象。问题是我无法获取用户管理器。
我正在使用 ASP.NET Core 3.1。我见过有些人使用 ApplicationUser
,如果可能的话,我不想使用它。谢谢:)
首先我尝试使用 userManager,但出现错误,userManager 为空。所以我尝试修复它,但无法创建 userManager 对象,
错误CS7036
没有给出与所需正式要求相对应的论点
'UserManager, IOptions, IPasswordHasher, IEnumerable> 的参数 'store', IEnumerable>、ILookupNormalizer、IdentityErrorDescriber、IServiceProvider、ILogger>)'"
I need some help about my ASP.NET Core project.
I need the connected user to create an object. The problem is I can't get the User manager.
I'm using ASP.NET Core 3.1. I've seen some people use ApplicationUser
, and if possible, I don't want to use it. Thanks :)
First I tried to use userManager, but get an error, userManager was null. So I tried to fix it, and I can't create a userManager object,
Error CS7036
There is no argument given that corresponds to the required formal
parameter 'store' of 'UserManager<IdentityUser.UserManager(IUserStore<IdentityUser>, IOptions<IdentityOptions>, IPasswordHasher<IdentityUser>, IEnumerable<IUserValidator<IdentityUser>>, IEnumerable<IPasswordValidator<IdentityUser>>, ILookupNormalizer, IdentityErrorDescriber, IServiceProvider, ILogger<UserManager<IdentityUser>>)'"
发布评论
评论(1)
根据您的提示,我的控制器代码如下,登录用户并测试我的方法后,我没有收到像您那样的错误。
MyController
Startup.cs
测试结果:
According to your hint, my controller code is as below, after logging in the user, and testing my method, I didn't get the kind of error like you got.
MyController
Startup.cs
Test Result: