Unable to serialize the session state when session mode is SqlServer
-
Hi, I have two web applications with session state mode = SQLServer. Both application are hosted in windows Server with different virtual names. Now I have added the link of application2 in application1 Viceversa added application1 link in application2 to come back. both applications are working fine..after some time when I click on link of application2 from application1 it is immediately displaying server error saying that " Unable to serialize the session state. In 'State Server' and 'SqlServer' mode, ASP.NET Will serialize the session state objects, and as a result non-serialize objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode." Application2 is having some sessions which holds some class objects, all classes are serialized classes, and also some sessions holds datatables and hash tables directly will it be any problem, if so what is the solution for this. As the site is in Live, It is very urgent to fix this issue. Please help me to overcome from this problem. Thanks Haribabu K
-
Hi, I have two web applications with session state mode = SQLServer. Both application are hosted in windows Server with different virtual names. Now I have added the link of application2 in application1 Viceversa added application1 link in application2 to come back. both applications are working fine..after some time when I click on link of application2 from application1 it is immediately displaying server error saying that " Unable to serialize the session state. In 'State Server' and 'SqlServer' mode, ASP.NET Will serialize the session state objects, and as a result non-serialize objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode." Application2 is having some sessions which holds some class objects, all classes are serialized classes, and also some sessions holds datatables and hash tables directly will it be any problem, if so what is the solution for this. As the site is in Live, It is very urgent to fix this issue. Please help me to overcome from this problem. Thanks Haribabu K
Did you put any object that is not serializable into session ? :confused:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Hi, I have two web applications with session state mode = SQLServer. Both application are hosted in windows Server with different virtual names. Now I have added the link of application2 in application1 Viceversa added application1 link in application2 to come back. both applications are working fine..after some time when I click on link of application2 from application1 it is immediately displaying server error saying that " Unable to serialize the session state. In 'State Server' and 'SqlServer' mode, ASP.NET Will serialize the session state objects, and as a result non-serialize objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode." Application2 is having some sessions which holds some class objects, all classes are serialized classes, and also some sessions holds datatables and hash tables directly will it be any problem, if so what is the solution for this. As the site is in Live, It is very urgent to fix this issue. Please help me to overcome from this problem. Thanks Haribabu K
Please have a look : Exploring Session in ASP.Net[^]
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Did you put any object that is not serializable into session ? :confused:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptHi Abhishek, Thanks for the reply, I am placing some class objects and List objects in sessions, but all classes are serialized. And also we are placing some dataset objects, DataTable objects and HashTable objects and ArrayList objects into sessions. will it be causing any problem.. if so what could be the solution..? else where is the problem. Thanks Haribabu K
-
Hi Abhishek, Thanks for the reply, I am placing some class objects and List objects in sessions, but all classes are serialized. And also we are placing some dataset objects, DataTable objects and HashTable objects and ArrayList objects into sessions. will it be causing any problem.. if so what could be the solution..? else where is the problem. Thanks Haribabu K
To have a good code, please dont put any complex objects in Session. Dont put
DataSets
,DataTables
,List
etc in session. I dont know why do you require this? If you see what a dataset serializes to, you will find there are lots of unnecessary properties and objects which it serializes. That means you will very easily eat up all the server memory within seconds. It is always recommended to put premitive types, structures in Session. If you are creating aSerializable
type, always useNotSerialisable
attribute for unnecessary public members. Why dont you put the id in session. It is a good technique to call database when needed for WEB environment rather than putting huge data into session. The only possibility to have corrupted session object is because of issues on Serialization. Check each object you put in session. There must be something. :rose:Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Hi Abhishek, Thanks for the reply, I am placing some class objects and List objects in sessions, but all classes are serialized. And also we are placing some dataset objects, DataTable objects and HashTable objects and ArrayList objects into sessions. will it be causing any problem.. if so what could be the solution..? else where is the problem. Thanks Haribabu K
Oh.. sorry... You re using Database as session... then it is ok. Just check if it is deserialised properly or not. :cool:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript