473,761 Members | 9,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialization error

Hi Everyone,

I was using Inprocess session objects, but incase of aspnet process
crashes the session objects were lost as a result I decided to shift to
out of porocess session objects. For this i had to serialize the
objects. While doing that I made the classes serializable whose objects
I store in sessions. However, when I run the application I get the
following error.


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.Http Exception: 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:
[SerializationEx ception: The type ASP.default_asp x in Assembly h5ahqjmx,
Version=0.0.0.0 , Culture=neutral , PublicKeyToken= null is not marked as
serializable.]

System.Runtime. Serialization.F ormatterService s.InternalGetSe rializableMembe rs(RuntimeType
type, Boolean excludeNonSeria lizable) +853

System.Runtime. Serialization.F ormatterService s.GetSerializab leMembers(Type
type, StreamingContex t context) +300

System.Runtime. Serialization.F ormatters.Binar y.WriteObjectIn fo.InitMemberIn fo()
+103

System.Runtime. Serialization.F ormatters.Binar y.WriteObjectIn fo.InitSerializ e(Object
obj, ISurrogateSelec tor surrogateSelect or, StreamingContex t context,
SerObjectInfoIn it serObjectInfoIn it, IFormatterConve rter converter) +493

System.Runtime. Serialization.F ormatters.Binar y.WriteObjectIn fo.Serialize(Ob ject
obj, ISurrogateSelec tor surrogateSelect or, StreamingContex t context,
SerObjectInfoIn it serObjectInfoIn it, IFormatterConve rter converter) +48

System.Runtime. Serialization.F ormatters.Binar y.ObjectWriter. Write(WriteObje ctInfo
objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +515

System.Runtime. Serialization.F ormatters.Binar y.ObjectWriter. Serialize(Objec t
graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +738

System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Serialize(St ream
serializationSt ream, Object graph, Header[] headers, Boolean fCheck) +136

System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Serialize(St ream
serializationSt ream, Object graph) +13
System.Web.Util .AltSerializati on.WriteValueTo Stream(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 .AltSerializati on.WriteValueTo Stream(Object value,
BinaryWriter writer)
System.Web.Sess ionState.Sessio nDictionary.Ser ialize(BinaryWr iter writer)

System.Web.Sess ionState.StateC lientManager.Se rialize(Session StateItem
item, Stream stream)

System.Web.Sess ionState.OutOfP rocStateClientM anager.System.W eb.SessionState .IStateClientMa nager.Set(Strin g
id, SessionStateIte m item, Boolean inStorage)
System.Web.Sess ionState.Sessio nStateModule.On ReleaseState(Ob ject
source, EventArgs eventArgs)

System.Web.Sync EventExecutionS tep.System.Web. HttpApplication +IExecutionStep .Execute()
+60
System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean&
completedSynchr onously) +87


I'll appreciate if anybody could help me with this.

Thanks.
Nov 18 '05 #1
2 2589
The thing you need to do is figure out everything that you are storing in a
Session variable, and determine from this which of these objects is not
serializable or inherit from the MarshallByRef object.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Maximus" <me@maximus.net > wrote in message
news:Op******** ******@TK2MSFTN GP11.phx.gbl...
Hi Everyone,

I was using Inprocess session objects, but incase of aspnet process
crashes the session objects were lost as a result I decided to shift to
out of porocess session objects. For this i had to serialize the objects.
While doing that I made the classes serializable whose objects I store in
sessions. However, when I run the application I get the following error.


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.Http Exception: 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:
[SerializationEx ception: The type ASP.default_asp x in Assembly h5ahqjmx,
Version=0.0.0.0 , Culture=neutral , PublicKeyToken= null is not marked as
serializable.]

System.Runtime. Serialization.F ormatterService s.InternalGetSe rializableMembe rs(RuntimeType
type, Boolean excludeNonSeria lizable) +853

System.Runtime. Serialization.F ormatterService s.GetSerializab leMembers(Type
type, StreamingContex t context) +300

System.Runtime. Serialization.F ormatters.Binar y.WriteObjectIn fo.InitMemberIn fo()
+103

System.Runtime. Serialization.F ormatters.Binar y.WriteObjectIn fo.InitSerializ e(Object
obj, ISurrogateSelec tor surrogateSelect or, StreamingContex t context,
SerObjectInfoIn it serObjectInfoIn it, IFormatterConve rter converter) +493

System.Runtime. Serialization.F ormatters.Binar y.WriteObjectIn fo.Serialize(Ob ject
obj, ISurrogateSelec tor surrogateSelect or, StreamingContex t context,
SerObjectInfoIn it serObjectInfoIn it, IFormatterConve rter converter) +48

System.Runtime. Serialization.F ormatters.Binar y.ObjectWriter. Write(WriteObje ctInfo
objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +515

System.Runtime. Serialization.F ormatters.Binar y.ObjectWriter. Serialize(Objec t
graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +738

System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Serialize(St ream
serializationSt ream, Object graph, Header[] headers, Boolean fCheck) +136

System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er.Serialize(St ream
serializationSt ream, Object graph) +13
System.Web.Util .AltSerializati on.WriteValueTo Stream(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 .AltSerializati on.WriteValueTo Stream(Object value,
BinaryWriter writer)
System.Web.Sess ionState.Sessio nDictionary.Ser ialize(BinaryWr iter
writer)

System.Web.Sess ionState.StateC lientManager.Se rialize(Session StateItem
item, Stream stream)

System.Web.Sess ionState.OutOfP rocStateClientM anager.System.W eb.SessionState .IStateClientMa nager.Set(Strin g
id, SessionStateIte m item, Boolean inStorage)
System.Web.Sess ionState.Sessio nStateModule.On ReleaseState(Ob ject
source, EventArgs eventArgs)

System.Web.Sync EventExecutionS tep.System.Web. HttpApplication +IExecutionStep .Execute()
+60
System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean&
completedSynchr onously) +87


I'll appreciate if anybody could help me with this.

Thanks.

Nov 18 '05 #2
Chris Jackson wrote:
The thing you need to do is figure out everything that you are storing in a
Session variable, and determine from this which of these objects is not
serializable or inherit from the MarshallByRef object.

Thanks for the reply, I tried that and have marked all the objects which
I could. In most cases it would tell me which object it could not
serialize. But here it is saying it cannot serialize 'ASP.default_as px
in Assembly 9iq31h5o'.
What I dont understand is why is it trying to serialize the default.aspx
page and also where is this assmebly Assembly 9iq31h5o created.

Any help will be appreciated.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1237
by: ktn | last post by:
Hi all, I'm a .NET beginner and I've got a problem on a program where I try to do an XML serialization. I get the following error : "An unmanaged exception of type 'System.IO.FileNotFoundException' occured in mscorlib.dll Additonal information : the file or asssembly named n9gu4-bo.dll or one of its dependencies cannot be found"
1
4365
by: andrewcw | last post by:
There is an error in XML document (1, 2). I used XML spy to create the XML and XSD. When I asked to have the XML validated it said it was OK. I used the .net SDK to generate the class. I have done this before but this time I have no idea why I am getting the error. Any ideas ?? THANKS ! <qcsttatus> <manual sourcerootfolder="" manualname="">
3
2458
by: Alexander | last post by:
When i store rule on PC with .NET.SP1 i cant restore them from PC without SP1. An i get this Error: System.Runtime.Serialization.SerializationException: Possible Version mismatch. Type System.Collections.Comparer has 1 members, number of members deserialized is 0. at System.Runtime.Serialization.Formatters.Binary.ReadObjectInfo.GetMemberTypes(String
1
3105
by: Sek | last post by:
Hi Folks, While deserialization in C#, i came across this error: "No assembly ID for object type <MyClassName>". The error is very abstract. Pls find below the stack trace. StackTrace at
0
348
by: CJ Taylor | last post by:
hey everyone, thought I would ask this here because the web service groups seems pretty light on conversation. I'm buliding a web service, but keep getting this error. I understand the error, read a work around, but don't know if its the best approach. Here is a link to the error... at least a description. http://support.microsoft.com/default.aspx?scid=kb;en-us;814187 i'm confused though. I looked at Icollection, and there is no...
3
15100
by: Paulo Morgado [MVP] | last post by:
Hi all ..NET Framework 1.1 I have created several types that are serailized to XML as strings. Someting like this: public struct MyInt32 : IXmlSerializable { int value;
2
1630
by: Norman Chong | last post by:
Hiddeldi ho, I want to save an object so that I can use its content after I restart my program. I tried to solve this with serialization because someone told me that this is the correct way for this. So I wrote the following code to serialize\deserialize the object, but now I have the problem that the object has a generic list and when I'm trying to deserialize it, I get an error. <System.Serializable()Public Class TestClass
8
12567
by: =?Utf-8?B?UGlnZ3k=?= | last post by:
Hi to all, I am getting this System.OutOfMemoryException calling the Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(<stream>,<Obj>) method. The type of <streamis IO.MemoryStream =====Exception: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
0
2479
by: =?Utf-8?B?Y211cmFsaQ==?= | last post by:
I am serializing/deserializing a class (Class1) using the XmlSerializer object in the System.Xml.Serialization namespace in .Net 2.0. Class1 has some strings and ints and two lists of other simple serializable classes (Class2 and Class3) Class1, Class2 and Class3 are defined in an assembly (Assembly1) which is loaded by another assembly (Assembly2). When I statically reference Assembly1 in Assembly2, serialization and deserialization...
0
9531
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.