如题我在Web中使用State Server来保存用户的Session我的Windows服务/应用程序怎么操作State Server里的指定用户的Session?在网上找了N久,没找到相关的文章,200分求代码,谢
解决方案 »
- netdotbar的问题
- 关于多个构造函数调用问题
- 2个数据库表之间及时同步
- XML问题
- 如何保证远程服务器上的类库只有自己编写的客户端程序才能调用
- ??怎样控制textBoxs中录入的数据?? c/s
- 我有一个C#的Winform项目,里面有许多的程序代码....丢了.sin文件可以新建一个添加现有项目搞定,可是丢了csproj文件,怎么办呀?/
- C# 操作 Paradox 可读 为什么不可更新、删除???
- 请问在C#中怎么动态设置控件的属性?
- 請教一個ASP.Net中dataGrid1選定一行后,得到該行的記錄,該怎樣實現呢!!
- xml 中的属性 也是随意定义的?
- 大家帮我看一下,这是什么编码呢。。
State Server
With the "State Server" model session information is stored in a separate "state server" process. The worker process (aspnet_wp.exe) will communicate with the State Server (aspnet_state.exe) to store and retrieve session information.If you are working in an environment where there is more than one web server then another key difference from the in-process model is that all the servers should be configured to talk to the same state server process. This is a configuration issue and it would be easy to (wrongly) configure a web farm to use separate state server process on each server.Storing session information in the state server has the following advantages:It is tolerant of the worker process being recycled. For developers this has the advantage (or disadvantage!) that session information is maintained across compiles of the application.
It is suitable for use on web-farms.
and the following disadvantages:It is slightly slower and more resource demanding than the in-process model, because:
there is an extra level of communication required between processes and
everything in the session needs to be serialized and de-serialized on each web request.
State information is stored on a single server - this is not an issue normally but might be if you need to avoid a single point of failure (in which case SQL Server is the route to go because it supports failover servers).
To configure to use the state server model requires the sessionState parameter in the web.config file to be updated:<sessionState
mode="StateServer"
stateConnectionString="tcpip=server1:42424"
cookieless="false"
timeout="20" />
The default entry for stateConnectionString is "stateConnectionString="tcpip=127.0.0.1:42424", this is reasonable if the state server is on the same server (The IP address 127.0.0.1 is by definition the local machine). If however you are running in a web-server environment then it is vitally important that you set the server name, so substitute the name of a server for "server1" in the above example. Otherwise each server will communicate with the state server process running locally and session information will not be shared between servers.You also need to ensure that the state server is running on the chosen server. Do this by looking at the services on the server and ensure that "ASP.NET State Service" is started and set to "Automatic" start-up.
Session可以存储【用户名+特殊字符+SessionID】
这样在服务器段,State Server不懂,
绑顶一下