1

I have been working on a project and it works fine on my development machine. When I move it to the stage server for testing I get the following error:

Unable to serialize the session state. In 'StateServer' and 'SQLServer'

The error message goes on to specify one of my business objects as the issue. The code was actually developed by another developer but I believe the issue is when a business object is saved into the session.

Why would that work on my local machine but not on the remote server?

4
  • 1
    Are u sure web.config is absolutely equal on both machines? if you use a state server all objects in the session MUST be serializable. Commented Oct 18, 2011 at 19:24
  • They are definitely not equal. Not even close. Is there a particular thing I should be looking for? Commented Oct 18, 2011 at 19:35
  • yes the session configuration. you should make sure all objects you put in the session are serializable or it wont work. Commented Oct 18, 2011 at 19:46
  • Is the object that you're serializing marked Serializable? Commented Oct 18, 2011 at 19:49

1 Answer 1

2

You development machine probably uses the InProc session provider which serializes onto memory. When the SQLServer session provider is used, there are are much stronger requirements on your objects.

Most probably - one of your objects is just not serializable. Reasons could vary, from simple "not marked as serializable" to "relying on external types which are not serializable".

Try to track down the problematic type by inspecting the inner exception. Usually you'll find a meaning information there.

Sign up to request clarification or add additional context in comments.

6 Comments

Is there a way I can check to see if the InProc is being used? Unfortunately the server is a client machine so I don't have much control over it. I did find another article that gave some code I can use to test if my object is serializable so I'll be testing that when I get a chance.
The sessionState element of the web.config controls the way your data is persisted in the session container. Apparently it's configured to InProc or SqlServer on your client's machine. Ask him to change it to InProc temporarily to make sure that the problem is there and take some time to fix your objects so that they could be serialized. msdn.microsoft.com/en-us/library/h6bb9cz9(VS.71).aspx
I don't have a sessionState tag in my local web config. What would the default be?
The default is InProc, that's why the application works for you locally. The client could have probably changed this setting in his local web.config, server-level web.config or machineHost.config.
It would inherit from machine.config if no web config overrode it.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.