Microsoft’s documentation states that the dataset is serializable. Yet, when I try to persist a dataset using out-of-proc session management using SQLServer, the session fails. I will need to use this method in order to scale up to and set up a web farm. What am I missing?
The code that fails according to the debugger:
Session(“disorder”) = Me.oOrder.GetOrderByOrderID(OrderID)
My web config file is set up this way:
<sessionState
mode="SQLServer"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password=somepwd"
cookieless="false"
timeout="20"
/>
When I run the above code, I get this error:
Server Error in '/MyTestApplication' Application.
________________________________________
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'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: 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'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SerializationException: The type OakLeaf.MM.Main.Data.mmDataSet in Assembly Mere Mortals Framework, Version=1.1.1119.20257, Culture=neutral, PublicKeyToken=511bd18e16c7f771 is not marked as serializable.]
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +600
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +683
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +136
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13
System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer)
[HttpException (0x80004005): 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'.]
System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer)
System.Web.SessionState.SessionDictionary.Serialize(BinaryWriter writer)
System.Web.SessionState.StateClientManager.Serialize(SessionStateItem item, Stream stream)
System.Web.SessionState.SqlStateClientManager.System.Web.SessionState.IStateClientManager.Set(String id, SessionStateItem item, Boolean inStorage)
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Regards,
Carl.
Carl Olson, Jr.
Cerelogic, Inc.
www.cerelogic.com770.577.0398 (Office)
Carl Olson, Jr.
CEO, Founder
Cerelogic, Inc.
www.cerelogic.com"Applying rocket science to business."