本文介绍了会话无任何理由到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我对网站应用程序有这个问题,说明问题,我的确切问题是我的会话过期和应用程序池被回收,这会删除我的所有页面进度等等,首先我在会话中使用我的签名信息,但现在我也将它存储在cookie中,所以当会话到期时,应用程序从cookie恢复登录信息。 Session.Add( sUserID,src.userID); Session.Add( suserLname,src.userLName); Response.Cookies [ abcdefCookie3]。Value = src.userID; Response.Cookies [ abcdefCookie3]。Expires = DateTime.Now.AddDays( 1 ); Response.Cookies [ abcdefCookie4]。Value = src.userFName; Response.Cookies [ abcdefCookie4]。Expires = DateTime.Now.AddDays( 1 ); 但其他信息如会话中的数据表,当然会因所谓的应用程序池回收而丢失...... 它在LOCALHOST上运行正常,但在主机服务上我一直面临这个问题,我有这些尝试过这些主机 1. One& One网站托管 2. HostMySite 3. SiteGator 和 4. CreativeOn i认为它可能会溢出内存,有很多会话变量所以我部署了一个中间页面(导航器),其中我使用了以下代码 string frwdAdd = Request.QueryString [ frwdAdd]; string sUserID =( string )会话[ sUserID]; string suserLname =( string )会话[ suserLname]; Session.Clear(); Session.Add( sUserID,sUserID); Session.Add( suserLname,suserLname); Response.Redirect( 〜/ + frwdAdd, true ); 使用这个我确实在会话过期/应用程序池回收之前得到了更多的时间,但最终它会过期... 所以,任何提示,任何链接,任何帮助将不胜感激。 解决方案 申请池设置IIS中的池大小 并使用web配置文件配置会话时间 ;最大池大小= 75000/> Hi Everyone, I have this problem with website application, coming to point, my exact problem is i get session expired and app pool recycled, which deletes all of my page progress and etc, firstly i was using my sign info in session, though now i am also storing it in cookies, so when the session expires, application restores the login info from cookies.Session.Add("sUserID", src.userID);Session.Add("suserLname", src.userLName);Response.Cookies["abcdefCookie3"].Value = src.userID;Response.Cookies["abcdefCookie3"].Expires = DateTime.Now.AddDays(1);Response.Cookies["abcdefCookie4"].Value = src.userFName;Response.Cookies["abcdefCookie4"].Expires = DateTime.Now.AddDays(1);but the other information like datatables in session, which of course gets lost with so called app pool recycling...It Runs fine on LOCALHOST but on hosting services i have been facing this issue, i have these tried these hosters1. One&One Website hosting2. HostMySite3. SiteGatorand4. CreativeOni thought it might be overflowing memory with a lot of session variables so i deployed a middle page (navigator) in which i used following codestring frwdAdd = Request.QueryString["frwdAdd"];string sUserID = (string)Session["sUserID"];string suserLname = (string)Session["suserLname"];Session.Clear();Session.Add("sUserID",sUserID);Session.Add("suserLname",suserLname);Response.Redirect("~/" + frwdAdd, true);using this i did get a little bit more time before session expired/app pool recycled, but eventually it expires...so guys any hint, any link, any help would be appreciated A LOT. 解决方案 for application pool set the pool size in IISand use web config file to configure the session timout;Max Pool Size=75000"/> 这篇关于会话无任何理由到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-22 18:09