Web应用程序和内存状态 [英] Web Application and In-Memory State

查看:176
本文介绍了Web应用程序和内存状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建在ASP.Net 4.0中的Web应用程序必须保持用户之间共享一个内存状态(最好的用户群之间说的)。它不是一个标准的应用程序和相关的一组用户的状态都/可/应的一组动作都完成后才能坚持(这可能需要一个半小时)。这种要求,不能更改。

I'm building a web application in ASP.Net 4.0 which must maintain an in-memory state shared between users (better to say between group of user). It is not a standard application and the state related to a group of users are/can/should be persisted only after a group of actions are completed (which can take half an hour). This requirement can't be changed.

据我知道我不能依赖于一个进程内的内存,因为回收,将清除我的状态。
我发现的唯一的解决方案是创建一个标准的应用程序(或Windows服务),监控,通过NamedPipe访问,将存储的所有信息。
(可靠性,我也将实施,其中,当所有用户的群体已经完成了他们的行为的第一道工序只终止的定制再循环)。

As far as i know I can't rely in an in-proc memory because a recycle will clear my state. The only solution I found is to create a standard application (or a windows service), monitored, accessible via NamedPipe, which will store all the information. (For reliability, I will also implement a custom recycle in which the first process is terminated only when all the groups of users have completed their actions).

你知道任何简单的方法,或库,可以帮助管理这个applciation的状态?
你有这个设计任何建议考虑我希望对国家的并发访问高度?

do you know any simpler way, or a library that could help to manage the state of this applciation ? Do you have any suggestion for this design considering I expect high level of concurrent access to the state ?

感谢。

推荐答案

存储在数据库中的会话数据,并使用为需要共享数据的用户的公共密钥。

Store the session data in a database and use a common key for the users that need to share the data.

不过,你说你不能使用一个数据库,它必须是在内存中。我的后首先想到的是做一些像你所描述的(与Web应用程序将调用服务器上的独立应用程序)。您还可以通过利用高速缓存来实现自己的目标,但我不是100%肯定这一点。 http://msdn.microsoft.com/en-us/library/ms972379.aspx - 缓存文章

But, you said you can't use a database and it has to be in memory. My first thought after that was to do something like what you described (with a standalone application on the server that the web application makes calls to). You may also be able to accomplish your objective by leveraging the Cache, but I'm not 100% sure about this. http://msdn.microsoft.com/en-us/library/ms972379.aspx - Caching article

呵呵,想法!在服务器上创建临时XML文件来跟踪每个这些多用户的会话,并在每个请求加载/解析。但尽管如此,这并不在内存中,所以也许这是没有好。

Oh, idea! Create a temporary XML file on the server to track each of these multiuser sessions, and load/parse at each request. But still, this isn't in memory, so maybe that's no good.

的HttpApplication 生命周期不会跨越到多个用户。我没有一点困惑的 HttpApplicationState 对象:

The HttpApplication lifecycle does not span to multiple users. I am not a little confused about the HttpApplicationState object:

[本文](http://msdn.microsoft.com/en-us/library/ms972109.aspx)表示,它跨越到应用程序的每一个用户。它基本上是一本字典。

[This article] (http://msdn.microsoft.com/en-us/library/ms972109.aspx) says it spans to every user of the application. It is basically a dictionary.

我也想你可能会从审查ASP.NET应用程序生命周期中受益。我将其作为参考文章 http://msdn.microsoft.com/en-美国/库/ ms178473.aspx 。祝你好运,让我们知道你到底是什么了做

I also think you might benefit from reviewing the ASP.NET Application life cycle. The article I use for reference is http://msdn.microsoft.com/en-us/library/ms178473.aspx . Good luck, and let us know what you end up doing

这篇关于Web应用程序和内存状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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