在共享主机上部署应用程序后,会话将被清除 [英] Session being cleared after deploying application on shared hosting

查看:72
本文介绍了在共享主机上部署应用程序后,会话将被清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我的Web应用程序在本地和Intranet上运行良好.

但是当我将其部署在共享主机上时,它会在20到30秒内被频繁清除.

我已将web.config和主机控制面板配置为50分钟的会话超时.

请提出建议.



My web application is working fine on local and intranet.

But when i deployed it on shared hosting its being cleared frequently in 20 to 30 seconds.

i have configured web.config and hosting control panel for session timeout for 50mins.

Please suggest.

推荐答案

您将必须与托管人联系.服务器可能在Web场中或处于负载平衡状态,这意味着您可能必须将会话移至数据库中,而不是使用RAM中的默认值.每个请求可能都将发送到不同的服务器,因此除非您移至db,否则不会保留您的会话.无论哪种方式,您都需要与您的托管服务商交谈以了解如何进行设置.

将会话移动到数据库非常容易.没有代码更改,只有web.config更改.请参阅 http://msdn.microsoft.com/en-us/library/h6bb9cz9(v = vs.71).aspx [
You will have to check with your hoster. It is likely the servers are in a web farm or are load balanced which means you may have to move your session into the db instead of using the defaults which are in RAM. Each request is likely going to a different server so your session is not preserved unless you move to db. Either way, you need to talk with your hoster to find out how they are setup.

Moving session to a db is very easy. No code changes, just web.config changes. See http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.71).aspx[^]


这篇关于在共享主机上部署应用程序后,会话将被清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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