![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi there, I was previously able to store my AsyncResult to the Session with the sessionstate mode="InProc" but now I get: System.Web.HttpException: Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. Is there any way to serialize the AsyncResult or is there some other workaround? It seems ridiculous that simply changing the mode of session storage should have such a radical effect on the design of an application. Thanks, Sean. |
#3
| |||
| |||
|
|
Hi, Storing session in a memory cache within the same process and remotely in the memory of another process is very different. InProc does not require serialization therefore any references can be stored while session state stored out of process has to be serialized for transmission. With the teams I work with I usually recommend that they develop with using the ASP.NET state service on the local machine. That way they do not get any surprises when they need to deploy to a web farm environment. -- Chris Taylor http://dotnetjunkies.com/weblog/chris.taylor sean.swords (AT) gmail (DOT) com> wrote in message news:1160141924.921162.152750 (AT) i42g2000cwa (DOT) googlegroups.com... Hi there, I was previously able to store my AsyncResult to the Session with the sessionstate mode="InProc" but now I get: System.Web.HttpException: Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. Is there any way to serialize the AsyncResult or is there some other workaround? It seems ridiculous that simply changing the mode of session storage should have such a radical effect on the design of an application. Thanks, Sean. |
#4
| |||
| |||
|
|
and so can the AsyncResult object be serialized? |
#5
| |||
| |||
|
|
Hi! and so can the AsyncResult object be serialized? No. You have to find another solution. You can keep the AsyncResults in a static collection witch is always a in-memory structure: class AsyncResultManager { static Dictionary<string, IAsyncResult> _dic = new ...; public IAsyncResult Get(string key){ return _dic[key]; } public void Set(string key, IAsyncResult ar){ _dic[key] = ar; } } Be be arware that every server within a web-farm maintains its own List. Completing asyncron calls from another server that have begun it is not supported (by every implementation I' aware of) anyway. GP |
#6
| |||
| |||
|
|
but I opted for a considerably simpler option that seems to work perfectly. I wanted to store the result in the session so I could maintain separate asynchronous operations for each logged in user. Cache("result" + Session.SessionID) = ar |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |