簡體   English   中英

ASP.NET Core-發布應用程序后無法使用signInManager登錄

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM