我在使用我網站上的MVC5 OWIN身份驗證時遇到了登錄持久性問題。MVC5 OWIN身份驗證持久性在本地工作,但在發佈時很快超時
我使用的是使用MVC5模板生成的代碼。當在VS本地運行時,它會讓我的用戶長時間登錄,但是當我發佈時,在服務器上它會在大約5分鐘後註銷。
我試圖改變已經在web.config
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
到
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
</system.webServer>
,但沒有奏效。
嘗試在Startup.Auth.cs中設置ExpireTimeSpan,但它沒有工作。
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
ExpireTimeSpan = new System.TimeSpan(20, 0, 0)
});
任何人都有任何想法我可以做什麼錯?
順便說一句,我沒有使用ExternalLogins。
嘗試在'ExpireTimeSpan'下面設置'SlidingExpiration = true' – Shoe