【发布时间】:2018-01-31 06:19:33
【问题描述】:
我在Startup.Auth.cs 中将会话超时设置为 3650 天。在我的电脑上它工作正常,会话永不过期,但在生产中它会在 30 分钟内过期。
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromDays(3650),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
},
ExpireTimeSpan = TimeSpan.FromDays(3650),
});
顺便说一句,我知道有两行代码来处理会话时间。起初,我只是使用
validateInterval: TimeSpan.FromDays(3650),
然后当我看到它不起作用时,我添加了最后一个,但它仍然无法用于生产。
那我还应该怎么做?
【问题讨论】: