简体   繁体   English

LMS网站超时问题

[英]Timeout issues with LMS website

The site is built using ASP.NET, C#.NET, JavaScript, Angular JS, HTML5 and CSS3. 该网站使用ASP.NET,C#.NET,JavaScript,Angular JS,HTML5和CSS3构建。

I have a couple of issues, then I am happy enough. 我有几个问题,那么我很高兴。

Main issue is the website keep timing out, after five minutes of inactivity. 主要问题是网站在闲置五分钟后保持超时。 eg logging off. 例如注销。

I really need the website to stay running so learners can simply go back four hours later? 我真的需要网站保持运转,以便学习者可以在四个小时后返回?

Is this possible? 这可能吗?

Here is the code, which I think controls the website timeout. 这是代码,我认为这可以控制网站超时。

<system.web>
<customErrors mode="On" defaultRedirect="~/Home/Error"></customErrors>
<!--<customErrors mode="Off"></customErrors>-->
<authentication mode="Forms">      
</authentication>
<!--<authorization>
  <allow  users="?" />
</authorization>-->
<sessionState timeout="10080"  />
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" maxRequestLength="1048576" executionTimeout="3600" />
<!--<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />-->
<httpModules>

Keep your session timeout relatively short. 保持会话超时时间相对较短。 A really long timeout can lead to memory and resource issues. 超时时间过长会导致内存和资源问题。 Instead, to prevent unexpected logouts or session timeouts, add some javascript into your page template that sends an ajax request to your server every so often. 相反,为了防止意外注销或会话超时,请在页面模板中添加一些JavaScript,该javascript经常向您的服务器发送ajax请求。 That will reset the session timeout. 这将重置会话超时。

In this way, the user will stay logged in as long as they leave a page open, but your server will still be able to reclaim the session resources soon after they leave the site. 这样,只要用户保持页面打开状态,用户就将保持登录状态,但是您的服务器仍然可以在离开站点后立即回收会话资源。

It's sometimes worthwhile to even have a special asp.net page where you can target these ajax requests, so that you don't waste resources building unnecessary content. 有时甚至值得拥有一个特殊的asp.net页面,您可以在其中定位这些ajax请求,以免浪费资源来构建不必要的内容。 If you want, you can have this page provide a json response and it becomes useful place to put updates back to user's browser from the server. 如果需要,您可以让此页面提供json响应,它成为从服务器将更新放回用户浏览器的有用位置。

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

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