简体   繁体   English

服务器上asp.net中的会话超时

[英]Session timeout in asp.net on server

I have a asp.net website hosted on the server. 我在服务器上托管了一个asp.net网站。 On localhost session timeout is working but on server it is not working (Around only 5 min). 在localhost会话上,超时有效,但在服务器上,超时无效(仅5分钟左右)。

I am using following code. 我正在使用以下代码。

  <sessionState
  mode="InProc"
  timeout="100"  />

Please help me. 请帮我。

In some cases, when you increase session timeout, then run web application, session will still expire. 在某些情况下,当增加会话超时,然后运行Web应用程序时,会话仍将过期。 There could be few possible reasons for this. 原因可能很少。

Notice that session timeout should be less than Application pool idle timeout, so if you increase session timeout, you have to increase application idle timeout too. 请注意,会话超时应小于应用程序池空闲超时,因此,如果增加会话超时,则也必须增加应用程序空闲超时。 Otherwise, application will get recycled. 否则,应用程序将被回收。 If application is recycled, sessions will expire automatically. 如果应用程序被回收,会话将自动过期。

Also, if you use Forms Authentication, you'll probably need to increase forms timeout too, using markup code in web.config like this: 另外,如果您使用表单身份验证,则可能还需要增加表单超时,使用web.config中的标记代码,如下所示:

    <system.web>
      <authentication mode="Forms">
        <forms timeout="60"/>
      </authentication>

    ...
    </system.web>

getting more info..see this link http://www.beansoftware.com/ASP.NET-Tutorials/Session-Timeout-Expiration.aspx 取得更多资讯

And for keep alive your session timeout..find this example for that.. http://www.beansoftware.com/ASP.NET-Tutorials/Keep-Session-Alive.aspx 为了保持会话超时,..为此找到示例。http://www.beansoftware.com/ASP.NET-Tutorials/Keep-Session-Alive.aspx

Set your session timeout minutes in IIS settings of your website on your server. 在服务器上网站的IIS设置中设置会话超时分钟。

For IIS steps follow this https://technet.microsoft.com/en-us/library/cc725820(v=ws.10).aspx 对于IIS步骤,请遵循以下https://technet.microsoft.com/zh-cn/library/cc725820(v=ws.10).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM