0
我有一個本地運行的ASP.NET核心應用程序,在那裏我可以登錄而沒有任何問題。但是,當我將應用發佈到我的服務器時,我無法登錄。我收到以下錯誤:無法找到此頁面。在我的服務器上能否登錄我的應用程序需要配置什麼?ASP.NET核心 - 當應用發佈時無法使用signInManager登錄
這裏是我使用登錄服務:
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();
}
}
[...]