简体   繁体   English

Web Host的设置奇怪,需要其他会话状态建议

[英]Web Host has strange settings, need alternative session state suggestions

I am building a web site for a sports club. 我正在为体育俱乐部建立一个网站。 The club is not interested in moving their hosting to a different web host, so I'm stuck with the current host. 俱乐部不希望将其托管服务移至其他网络托管服务商,因此我对当前的托管服务商感到困惑。 I deployed the new web application to the host, but after a few hours of testing it became obvious something was acting weird with regards to logins and the session state. 我将新的Web应用程序部署到主机上,但是经过几个小时的测试,很明显在登录名和会话状态方面有些奇怪。

Whenever I spent more than 10 minutes idle, all of a sudden my MVC Verification Tokens would stop decrypting. 每当我闲置超过10分钟时,我的MVC验证令牌突然就会停止解密。 I went into IIS and set the machine key to a static value, and this problem went away, but it became obvious that they had the ASP.NET idle timeout setting set to 10 minutes. 我进入IIS并将机器密钥设置为静态值,此问题消失了,但是很明显,他们将ASP.NET空闲超时设置设置为10分钟。 Which means that every 10 minutes InProc session data would be destroyed if there was no activity on the site. 这意味着,如果站点上没有任何活动,则每10分钟InProc会话数据将被破坏。 I filed a support ticket with the host, but they are unwilling to change that setting for me on my app pool, stating "The setting can't be changed on the server at this time as increasing this could affect the performance off(sic) the server". 我向主机提交了支持票,但他们不愿意在我的应用程序池中为我更改该设置,并指出“目前无法在服务器上更改该设置,因为增加此设置可能会影响性能(原文如此)服务器”。

The club is somewhat small, at most 500 members of the club and very few of the members will be accessing the site often, so I can pretty much guarantee that the 10 minute timeout will be happening multiple times a day, and I have session timeouts set to 60 minutes, so it won't be a good idea to have the site clear sessions if the sole user of the site at a given time is idle for 10 minutes. 俱乐部有点小,最多只有500个俱乐部成员,而且很少有成员会经常访问该站点,因此我可以保证10分钟超时每天会发生多次,并且我有会话超时设置为60分钟,因此,如果网站的唯一用户在给定时间闲置10分钟,则最好进行网站畅通会话。

My first thought was to use SQL session storage. 我的第一个想法是使用SQL会话存储。 I've never used it, but I know it exists. 我从未使用过它,但我知道它存在。 However, one caveat that exists is that we are limited to 350mb of SQL storage. 但是,存在一个警告,就是我们只能使用350mb的SQL存储。 While this is probably more than the site will need right now, I imagine down the line we might come close to hitting the limit. 尽管这可能超出该站点目前所需的容量,但我想我们可能会接近极限。 I don't anticipate storing much data in the session, only a few things when interacting with paypal and shopping carts (maybe a system message here or there as well), so perhaps this isn't a huge concern? 我预计不会在会话中存储大量数据,与Paypal和购物车进行交互时仅存储少量内容(可能在此处或在此处显示系统消息),所以这不是一个大问题吗?

We do have unlimited disk space, so another alternative I thought about was to perhaps write a custom disk-based session storage solution. 我们确实有无限的磁盘空间,所以我想到的另一种选择是编写一个基于磁盘的自定义会话存储解决方案。 Is there any reason this might not be a better idea than SQL? 有什么原因可能不是SQL更好的主意吗?

And finally, I had a totally off-the-wall "oh god I can't believe I'm thinking about doing this" idea, which would be to have an AJAX call on every page periodically (say, every 8 minutes) "ping" a non-cached lightweight MVC action just to keep the server alive. 最后,我有了一个完全不合时宜的“哦,天哪,我不敢相信我正在考虑这样做”的想法,那就是定期(例如每8分钟)在每个页面上进行一次AJAX调用” ping”非缓存的轻量级MVC操作只是为了保持服务器的活动状态。 This would probably work, I think, except for the one scenario where someone: 我认为,这可能会起作用,但以下情况除外:

  1. goes to the shopping page and creates a cart 转到购物页面并创建购物车
  2. gets transferred to paypal 被转移到贝宝
  3. spends 10+ minutes on the paypal screen for whatever reason while nobody else is on the site 无论出于何种原因,花了10分钟以上的时间在贝宝屏幕上,而网站上没有其他人
  4. comes back to see their cart disappear. 回来看到他们的购物车消失了。

In this instance I might just move carts to the database anyway. 在这种情况下,无论如何我可能只是将购物车移至数据库。

So... thoughts, comments, suggestions? 那么...的想法,评论和建议? I'm really frustrated about the host not letting me change this setting and my first instinct would be to find another host, but as I said before, the club has some strange attachment to the host and doesn't want to move somewhere else. 我真的对主持人不让我更改此设置感到沮丧,而我的本能是寻找另一个主持人,但是正如我之前所说,俱乐部对主持人有一些陌生的依恋,并且不想搬到其他地方。

Thanks in advance! 提前致谢!

A few thoughts: 一些想法:

On the problem: It's common for sessions to be 'lost' on Load Balancing systems. 问题所在:会话在负载平衡系统上“丢失”是很常见的。 This could possibly be fixed by moving to a single designated server (if the hosting company isn't doing this now and provides the option 可以通过移动到单个指定服务器来解决此问题(如果托管公司现在不这样做,并提供选项

Cookie sessions: If you're using .Net Membership, you can change the login process to use cookies. Cookie会话:如果您使用的是.Net Membership,则可以将登录过程更改为使用Cookie。 This comes with the obvious some users dont allow cookies pitfall. 显而易见, 有些用户不允许cookie陷阱。 Again, a consideration. 再次考虑。 Currently working on a school site where they want users to remain logged in. 当前在学校网站上工作,他们希望用户保持登录状态。

** With Cookies your Login is stable, but your sessions will not be any better kept. **使用Cookies,您的登录名是稳定的,但是您的会话将不会得到更好的保留。 So you're out of luck carrying much to count on in the Session State. 因此,您很不走运,可以在会话状态中发挥更大的作用。

The end result is that you can track users by IP or Cookie, but unless this is a fixable Load Balancing problem, you're heading toward a Session-less application. 最终结果是您可以通过IP或Cookie跟踪用户,但是除非这是一个可修复的负载平衡问题,否则您将转向无会话应用程序。

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

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