[英]ASP.NET Core - Unable to signIn with signInManager when app is published
我有一个本地运行的ASP.NET Core应用程序,可以毫无问题地登录。 但是,将应用发布到服务器时,我无法登录。 我收到以下错误:找不到此页面。 我需要在服务器上进行一些配置才能登录我的应用程序吗?
这是我用来登录的服务:
public class IdentityAuthenticationService : IAuthenticationService
{
private UserManager<IdentityApplicationUser> userManager;
private SignInManager<IdentityApplicationUser> signInManager;
private RoleManager<IdentityRole> roleManager;
public IdentityAuthenticationService
(
UserManager<IdentityApplicationUser> userManager,
SignInManager<IdentityApplicationUser> signInManager,
RoleManager<IdentityRole> roleManager
)
{
this.userManager = userManager;
this.signInManager = signInManager;
this.roleManager = roleManager;
}
public async Task LoginAsync(string username, string password)
{
//This line is where the error comes from
var result = await signInManager.PasswordSignInAsync(username, password, isPersistent: false, lockoutOnFailure: false);
if (!result.Succeeded) {
throw new InvalidLoginException();
}
}
[...]
您是否发布了该项目? 引用此链接
您是否设置了“开始默认值”页面? 在webconfig中? 像这样的东西
<authentication mode="Forms">
<forms loginUrl="login.aspx" protection="All" timeout="120" name=".ASPXAUTH" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false"/>
</authentication>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.