P
Patrick Nolan
(C#)
I am attempting to change the way I handle my session variables from
"Inproc" to "SQLServer".
After following the directions on Micorsoft's site, I now get this error
when running my project:
"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'"
The Stack trace is as follows:
[SerializationException: The type System.Data.SqlClient.SqlConnection in
Assembly System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMember
s(RuntimeType type, Boolean excludeNonSerializable) +853
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type
type, StreamingContext context) +300
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInf
o() +103
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize
(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context,
SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Obj
ect 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(Str
eam serializationStream, Object graph, Header[] headers, Boolean fCheck)
+136
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Str
eam 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.IState
ClientManager.Set(String id, SessionStateItem item, Boolean inStorage)
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source,
EventArgs eventArgs)
System.Web.SessionState.SessionStateModule.OnEndRequest(Object source,
EventArgs eventArgs) +44
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.
Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +87
I have the [Serialization] statement in my code when defining the page
class as directed by Microsoft and various other web sites.
The Serialization error seems to focus on my SQL Connection.
Any ideas to get me in the right direction are apprectiated.
-Patrick
(e-mail address removed)
I am attempting to change the way I handle my session variables from
"Inproc" to "SQLServer".
After following the directions on Micorsoft's site, I now get this error
when running my project:
"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'"
The Stack trace is as follows:
[SerializationException: The type System.Data.SqlClient.SqlConnection in
Assembly System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMember
s(RuntimeType type, Boolean excludeNonSerializable) +853
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type
type, StreamingContext context) +300
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInf
o() +103
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize
(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context,
SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Obj
ect 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(Str
eam serializationStream, Object graph, Header[] headers, Boolean fCheck)
+136
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Str
eam 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.IState
ClientManager.Set(String id, SessionStateItem item, Boolean inStorage)
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source,
EventArgs eventArgs)
System.Web.SessionState.SessionStateModule.OnEndRequest(Object source,
EventArgs eventArgs) +44
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.
Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +87
I have the [Serialization] statement in my code when defining the page
class as directed by Microsoft and various other web sites.
The Serialization error seems to focus on my SQL Connection.
Any ideas to get me in the right direction are apprectiated.
-Patrick
(e-mail address removed)