2013-03-07 45 views
2

我有以下配置嘗試允許會話保留大約239分鐘,但會話在不到一個小時內丟失。MVC ASP.NET網站早於設置顯示

<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#代碼覆蓋這些設置。

有誰知道爲什麼會發生這種情況?

+0

當您使用是InProc會話上,很可能較早失去它。嘗試將其移動到數據庫。 – Aristos 2013-03-07 12:54:33

回答

3

您還有一個空閒超時默認情況下設置爲20分鐘的應用程序池進程的設置。每20分鐘(如果沒有活動),應用程序池將被重置,這也會丟棄任何活動的進程內會話。

enter image description here

+1

IIS設置已更改並經過測試確定 - 點謝謝完美答案 – user1444886 2013-03-07 15:28:24