简体   繁体   English

Windows Azure平台上的Web应用程序中的会话超时

[英]Session timeout in web application on window Azure platform

I need your help to sort out one problem with session timeout in my application which are hosted on Azure platform. 我需要您的帮助来解决Azure平台上托管的应用程序中的会话超时问题。

I have developed web application in asp.net and make login functionality with session and put following code maintain timeout period for session like 我在asp.net中开发了Web应用程序,并使用会话进行登录功能,并使用以下代码维护会话的超时时间,例如

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

It working fine on local system but when i will tested it with live URL on Azure platform it will signout frequently (session expired). 它在本地系统上可以正常工作,但是当我在Azure平台上使用实时URL测试它时,它将经常注销(会话已过期)。

Can any one please suggest me how can i resolve this issues? 有人可以建议我如何解决这个问题吗?

Thanks Arun. 谢谢阿伦

Are you running more than one WebRole instance? 您是否在运行多个WebRole实例? Remember, "InProc" session-state will not be shared across multiple web-role instances. 请记住,“ InProc”会话状态不会在多个Web角色实例之间共享。 In fact, InProc session state is "evil" in the cloud world, will not work for any deployments with more than 1 instance running. 实际上,InProc会话状态在云世界中是“邪恶的”,不适用于运行多个实例的任何部署。 You really want to use another provider, like Session provider for AppFabric Cache 您确实要使用其他提供程序,例如AppFabric Cache的会话提供程序

Are you sure the session is expiring? 您确定会话即将到期吗? If you are using ASP.NET forms authentication there is another timeout to consider (here I have set it to 180 mins) 如果您使用的是ASP.NET表单身份验证,则需要考虑另一个超时(此处将其设置为180分钟)

<authentication mode="Forms">
  <forms loginUrl="Login/" timeout="180"/>
</authentication>

If you do have multiple instances Igorek is right - the session will not be shared. 如果您确实有多个实例,则Igorek是正确的-该会话将不会共享。

Please see how-does-microsoft-azure-handle-session-state/1023125#1023125 or refer to the Azure SDK for more information. 请参阅how-does-microsoft-azure-handle-session-state / 1023125#1023125或参考Azure SDK了解更多信息。

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

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