Unable to serialize the session state

后端 未结 8 1688
一生所求
一生所求 2020-12-01 23:06

When putting my application on a web server and trying to \'log in\' I get the following error:

Server Error in \'/\' Application.
Unable to serialize the se         


        
相关标签:
8条回答
  • 2020-12-02 00:04

    There is another solution, While inheriting a non-serializable class also implment ISerlializable interface GetObjectData method. Inherited class should also be marked as [Serializable].

    0 讨论(0)
  • 2020-12-02 00:05

    The regular session is simply stored in memory, but when you are working in a load-balanced environment you cannot rely on the same server handling postbacks why the session must be stored in a shared session mechanism primarily SQL Server and StateServer.

    This can be configured in machine.config or somewhere deeper than the app web.config why might not be aware of such a change but it could explain your sudden exception when deploying to the internet.

    As mentioned in another answer and in the comments the problem would then arise when the session object is not [Serializable]; while you are working in regular session the object is not serialized but just stored in server memory, but going online introduces different session mechanisms and the need for the objects to be serializable.

    0 讨论(0)
提交回复
热议问题