OWIN 인증을 사용하여 개발 컴퓨터 (Windows 10/IIS 10)에서 제대로 작동하지만 웹 응용 프로그램을 Windows 2000 서버에 게시 할 때 ASP.NET 웹 응용 프로그램을 개발했습니다. IIS 8.5에서는 쿠키 인증이 작동하지 않습니다.OWIN 쿠키 인증이 IIS 8.5에서 작동하지 않습니다.
IsPersistent 설정을 true로 설정하여 로그인하고 브라우저를 닫을 때 브라우저를 다시 시작하면 여전히 로그온되어 있으므로 정상적으로 작동합니다. 그러나 IIS를 다시 시작하고 브라우저를 시작하면 다시 로그온해야합니다.
나는 다음과 같은 코드로,이를 테스트 할 수있는 매우 간단한 응용 프로그램을 만들었습니다:
Startup.cs
public void ConfigureAuthentication(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Login"),
CookieName = "ThisIsTheAuthCookie"
});
}
AuthenticationController.cs
public ActionResult Login(string userName, string password)
{
//For testing purposes every user/pwd is fine
var identity = new ClaimsIdentity(new [] { new Claim(ClaimTypes.Name, userName), },
DefaultAuthenticationTypes.ApplicationCookie,
ClaimTypes.Name, ClaimTypes.Role);
HttpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties { IsPersistent = true }, identity);
return RedirectToAction("index", "home");
}
에도 크롬을 쿠키를 보여 주지만 IIS 8.5에서 OWIN이 사용하지 않는 것처럼 보입니다.
누구에게 문제가 있는지 생각해보십시오. 사용자 에이전트를 유지하면서 IIS 1. 다시 시작 - :
들으, 대니
좋습니다, 테스트 해 결과를 알려 드리겠습니다. – dennieku
브라우저를 열어 IIS를 다시 시작한 후에 다시 로그인해야했습니다. 간단한 로깅 OWIN 미들웨어를 추가했지만 오류가 발생하지 않았습니다. – dennieku
사용자 지정 쿠키 관리자를 추가하여 요청 중에 쿠키가 읽히는 지 확인합니다. 로깅은 쿠키가 올바르게 읽혀 졌음을 보여 주었지만 OWIN은 쿠키를 사용하여 사용자를 인증하지 않았습니다. – dennieku