AspNetCore.Identity
和内置服务收集容器
AspNet.Identity
和 Autofac 容器
UserManager<Users>
实现用户相关的功能并且它工作完美,但是当我尝试使用
SigninManager<Users>
实现登录功能时,我收到错误。在经典 .NET Framework 应用程序中,在运行时解析服务时:
authServices = lifetimeScope.Resolve<IAuthenticationService>();
Autofac.Core.DependencyResolutionException:'激活 Security.Authentication.AuthenticationService -> Security.Provider.SecSignInManager`1[[Entity.UserManagement.Users,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null] 时引发异常].'这是因为在
SigninManager
中,无法解析
IAuthenticationManager
。在 .NET Core 应用程序中,在运行时在方法
PasswordSignInAsync
中验证用户时,我收到此错误:
System.InvalidOperationException:“HttpContext 不得为空。”请问有人可以建议如何处理这种情况吗?
这是一个 Winforms 应用程序,我没有
HttpContext
。如何解析
IAuthenticationManager
以及如何使用依赖注入在 Windows/控制台应用程序中使用
SignInManager
?