ASP.NET会话结束突然 [英] ASP.NET Session ending abruptly

查看:207
本文介绍了ASP.NET会话结束突然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序的会话突然终止,并没有看到的Application_Error正在生成在Global.asax中的任何错误。此外,在session_start事件触发而不是Session_End中。之后,我主持一个服务器上的应用和我的开发机器上不会发生这种事。

,以产生这种自动退出的步骤是,加载页面之间进行切换并显示的对象(客户,管理等)的列表。约30-40秒的活动后,用户将被注销,并显示登录界面。任何想法可能会错误幕后?

Web.Config中具有用于会话和认证以下设置:

 <的sessionState超时=60模式=是InProc无Cookie =FALSE/>

验证:

 <形式的名称=XXX.AUTHloginUrl =〜/ login.aspx的保护=所有超时=60路径=/requireSSL =假slidingExpiration =真defaultUrl =〜/ Default.aspx的enableCrossAp predirects =FALSE/>< /认证>


解决方案

您主办共享主机环境(即从托管服务提供商GoDaddy的一样)?他们可能是回收每分钟左右IIS工作进程,在这种情况下,你会失去你的会话信息。你必须使用某种类型的进程外会话状态,如状态服务器或SQL状态服务器,以避免这种情况。

这里的 MSDN 上的文章。

My application's session is ending abruptly and don't see any error being generated in Application_Error in Global.asax. Also, the Session_Start event fires but not Session_End. It happens after I host the application on a server and does not happen on my dev machine.

The steps to generate this auto exit is to switch between pages that load and display a list of objects (Client, Managers, etc). After about 30-40 seconds of activity, the user is logged out and Login screen is displayed. Any ideas what could be going wrong behind the scenes?

Web.Config has the following settings for session and authentication:

<sessionState timeout="60" mode="InProc" cookieless="false"/>

authentication:

<forms name="XXX.AUTH" loginUrl="~/login.aspx" protection="All" timeout="60" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="~/default.aspx" enableCrossAppRedirects="false"/></authentication>

解决方案

Are you hosting on a shared hosting environment (i.e. from a hosting provider like GoDaddy)? They may be recycling the IIS worker process every minute or so, in which case you'd lose your session information. You'd have to use some type of out-of-process session state such as a state server or Sql State Server to avoid that.

Here's the MSDN article on it.

这篇关于ASP.NET会话结束突然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆