简体   繁体   English

长时间运行的请求期间ASP.NET会话超时

[英]ASP.NET session timeout during long running request

I have an app which has as session timeout of an hour. 我有一个会话超时为一个小时的应用程序。 however, I want the user to be able to upload huge files which may take much more than this so I have set the execution timeout to 1 day (ie larger than the session timeout). 但是,我希望用户能够上载比这可能花费更多时间的大文件,因此我将执行超时设置为1天(即大于会话超时)。

Am I guaranteed by ASP.NET that the session won't time out during a long-running request? 我可以通过ASP.NET保证在长时间运行的请求期间会话不会超时吗? I have tested this and it seems to work OK, but of course there are a number of possible environmental factors which could cause it to work in my test environment but not other deployment scenarios 我已经对此进行了测试,但似乎可以正常工作,但是当然,有许多可能的环境因素可能导致它在我的测试环境中工作,但在其他部署方案中却没有

If you set it to 1 day (24 hours) then the session will be good for that long. 如果将其设置为1天(24小时),则该会议将持续很长时间。 Session will reset when you do: 执行以下操作时,会话将重置:

IISReset IIS重置

Recycle App Pool 回收应用程序池

Be careful, everyone's session will be that long if you do this. 请注意,如果您这样做的话,每个人的会话将持续很长时间。 If your site has heavy usage, you will have memory problems. 如果您的站点使用率很高,则将出现内存问题。 Session is stored in the server it self. 会话本身存储在服务器中。 Also, you could have the option to extend the users session on the "upload page" and only users on that page will have a long session. 另外,您可以选择在“上载页面”上扩展用户会话,只有该页面上的用户会有较长的会话。 Once upload is done, you could end the session, keeping it a little cleaner. 上传完成后,您可以结束会话,从而使其更加整洁。

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

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