我有一个在本地运行的ASP.NET核心应用程序,我可以毫无问题地登录。但是,当我将应用程序发布到服务器时,我无法登录。我收到以下错误:找不到此页面。我的服务器上是否需要配置一些能够登录我的应用程序的东西?
以下是我用来登录的服务:
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 :(得分:0)
您是否设置了“启动默认”页面?在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>