2015-06-20 82 views
0

我正在學習asp.net MVC應用程序中的開放認證。 通過登錄Facebook谷歌工作正常,但部署會話很快到期。主要是由於應用程序池回收。在我的本地系統工作正常。Asp.net MVC Oauth會話快速到期

我之前在表單身份驗證時遇到了同樣的問題,通過將會話狀態模式從「in proc」更改爲「狀態服務器」工作。如何爲開放認證做同樣的事情?

我已經在許多情況下設置會話超時值高像

app.UseCookieAuthentication(new CookieAuthenticationOptions 
      { 
       AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 
       LoginPath = new PathString("/Account/Login"), 
       Provider = new CookieAuthenticationProvider 
       { 
        OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
         validateInterval: TimeSpan.FromMinutes(30), 
         regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) 
       }, 
       ExpireTimeSpan = new TimeSpan(1, 2, 30), 
       SlidingExpiration = true 
      }); 

回答

0

,共享的Web服務器不允許長時間會話到期時間!你有沒有試過保存sessions in SQL Server

+0

謝謝。這是真的,但問題是關於認證信息而不是會話。會議很好。 – Satyajit

+0

我猜你是在談論會話超時在服務器和高值不工作..實際上你沒有提到_authentication info_。 @Satyajit –