【问题标题】:MVC ASP.NET website logging out earlier than settings showMVC ASP.NET 网站在设置显示之前注销
【发布时间】:2013-03-10 17:43:54
【问题描述】:

我有以下配置,试图让会话保留大约 239 分钟,但会话在不到一个小时内丢失。

<system.web>
<sessionState mode="InProc" timeout="240" />
<compilation debug="true" targetFramework="4.0">
  <assemblies>
       ...
  </assemblies>
</compilation>
<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="239" />
</authentication>
<pages>
  <namespaces>
       ...
  </namespaces>
</pages>

我认为没有任何 C# 代码会覆盖这些设置。

有人知道为什么会这样吗?

【问题讨论】:

  • 当你在 session 上使用 InProc 时,很可能会提前丢失它。尝试将其移至数据库。

标签: asp.net-mvc session


【解决方案1】:

您在应用程序池进程上还有一个 空闲超时 设置,默认设置为 20 分钟,例如每 20 分钟(如果没有活动)应用程序池会重置一次,这也会丢弃任何活动的进程内会话。

【讨论】:

  • IIS 设置已更改并经过测试确定 - 感谢完美答案
【解决方案2】:
猜你喜欢
  • 1970-01-01
  • 2017-05-28
  • 1970-01-01
  • 2020-01-21
  • 1970-01-01
  • 2023-04-08
  • 1970-01-01
  • 2013-07-24
  • 2016-01-20
相关资源
最近更新 更多