2017-06-13 79 views
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(); 
     } 
    } 
    [...] 

回答

0

難道ü發佈的項目? Refer this link

你有沒有設置一個開始默認頁面?在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> 
相關問題