473,395 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

SQL Server session not working...

NAT

I was using session mode as "InProc"(entered in web.config). I have deployed
my ASP.NET appln. on a server which uses Load Balancer. i.e I have two
servers. I am using session across pages.The problem I was facing is that
sometimes I find the session and sometimes not. I beleive this is happenning
because of multiple servers. Because session is created on a worker process
on one server and the second time it must be hitting the other server to
fetch the
session. Hence the issue.I then used SQL Server session mode but now I get
the errror "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'. "
Any Idea ? Thanks in advance..
Jun 14 '06 #1
4 5687
Check all objects that you are storing in session. One of your objects is
exposing an object as public property or field which is non serialzable. An
example could be Thread object which is not serialzable.

Winista
http://www.universalshoppingmall
"NAT" <NA*@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...

I was using session mode as "InProc"(entered in web.config). I have
deployed
my ASP.NET appln. on a server which uses Load Balancer. i.e I have two
servers. I am using session across pages.The problem I was facing is that
sometimes I find the session and sometimes not. I beleive this is
happenning
because of multiple servers. Because session is created on a worker
process
on one server and the second time it must be hitting the other server to
fetch the
session. Hence the issue.I then used SQL Server session mode but now I get
the errror "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'. "
Any Idea ? Thanks in advance..

Jun 14 '06 #2
NAT
So do I need to serialize it ? How can i ?

"Winista" wrote:
Check all objects that you are storing in session. One of your objects is
exposing an object as public property or field which is non serialzable. An
example could be Thread object which is not serialzable.

Winista
http://www.universalshoppingmall
"NAT" <NA*@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...

I was using session mode as "InProc"(entered in web.config). I have
deployed
my ASP.NET appln. on a server which uses Load Balancer. i.e I have two
servers. I am using session across pages.The problem I was facing is that
sometimes I find the session and sometimes not. I beleive this is
happenning
because of multiple servers. Because session is created on a worker
process
on one server and the second time it must be hitting the other server to
fetch the
session. Hence the issue.I then used SQL Server session mode but now I get
the errror "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'. "
Any Idea ? Thanks in advance..


Jun 14 '06 #3
If there is something that does not need to be serialized, make them
non-public or decorate then with Non-serialzable attribute. You will have to
look at your objects closely to make the decision. and if there is something
that needs to be serialzable and by default does not do it by itself then
you will have to manually serialize those objects.
Also put [Serializable] attributes on your objects.

"NAT" <NA*@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
So do I need to serialize it ? How can i ?

"Winista" wrote:
Check all objects that you are storing in session. One of your objects is
exposing an object as public property or field which is non serialzable.
An
example could be Thread object which is not serialzable.

Winista
http://www.universalshoppingmall
"NAT" <NA*@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
>
> I was using session mode as "InProc"(entered in web.config). I have
> deployed
> my ASP.NET appln. on a server which uses Load Balancer. i.e I have two
> servers. I am using session across pages.The problem I was facing is
> that
> sometimes I find the session and sometimes not. I beleive this is
> happenning
> because of multiple servers. Because session is created on a worker
> process
> on one server and the second time it must be hitting the other server
> to
> fetch the
> session. Hence the issue.I then used SQL Server session mode but now I
> get
> the errror "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'. "
> Any Idea ? Thanks in advance..


Jun 14 '06 #4
note: some object can not be serialized, such as sqlconnections,
datareaders, streams, com interop objects, collections containing a
non-serializable object, etc. in this case you must be redesign you session
data.

you'd think, when asp.net tried to serialize session data, it would list the
name of the object. to find the offending object:

try (air code)

MemoryStream myWriter = new MemoryStream ();
foreach (string key in Session.AllKeys)
{
object o = Session[key];
try
{
XmlSerializer mySerializer = new XmlSerializer(o.GetType());
mySerializer.Serialize(myWriter, o);
}
catch
{
Debug.Print("Unable to serialize: " + key);
}
}
myWriter.Close();
-- bruce (sqlwork.com)


-- bruce (sqlwork.com)


"Winista" <na*********@hotmail.com> wrote in message
news:O4**************@TK2MSFTNGP02.phx.gbl...
If there is something that does not need to be serialized, make them
non-public or decorate then with Non-serialzable attribute. You will have
to look at your objects closely to make the decision. and if there is
something that needs to be serialzable and by default does not do it by
itself then you will have to manually serialize those objects.
Also put [Serializable] attributes on your objects.

"NAT" <NA*@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
So do I need to serialize it ? How can i ?

"Winista" wrote:
Check all objects that you are storing in session. One of your objects
is
exposing an object as public property or field which is non serialzable.
An
example could be Thread object which is not serialzable.

Winista
http://www.universalshoppingmall
"NAT" <NA*@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
>
> I was using session mode as "InProc"(entered in web.config). I have
> deployed
> my ASP.NET appln. on a server which uses Load Balancer. i.e I have two
> servers. I am using session across pages.The problem I was facing is
> that
> sometimes I find the session and sometimes not. I beleive this is
> happenning
> because of multiple servers. Because session is created on a worker
> process
> on one server and the second time it must be hitting the other server
> to
> fetch the
> session. Hence the issue.I then used SQL Server session mode but now I
> get
> the errror "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'. "
> Any Idea ? Thanks in advance..


Jun 14 '06 #5

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

Similar topics

6
by: Ilia | last post by:
Hi folks, I have some problems with ASP.NET Session State. The following simple program runs well if the Session State set as "InProc". If I switch to "SQLServer", the changes, made by the...
2
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings...
8
by: Beve Lyni | last post by:
I am running an asp.net project on my localhost and using state server as state management, it has the following code in web.config <sessionState mode="StateServer"...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
12
by: SAL | last post by:
Hello, Is it possible to read a CSV from the Client, and bind my Datagrid to the data in the CSV file without uploading the file to the Server first? I have tried and in Debug mode on my...
1
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class...
1
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they...
5
by: greg | last post by:
Written in Asp.Net 2.0 The session_start fires on Development server running withing Visual Studio 2005 and also if access web site via localhost on development machine. But if copy to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.