ASP.NET Session size limitation

后端 未结 4 1819
臣服心动
臣服心动 2020-11-30 07:57

Is there some kind of Session size limitation or advisable value to not to surpass ?

In my web application I create a few DataTables to store user selections which a

4条回答
  •  伪装坚强ぢ
    2020-11-30 08:25

    Here's a few notes about Session state:

    • InProc (mode="InProc") session state is limited to the amount of memory available to the worker process. Only object references are stored, not the objects themselves.

    Out of process state management serialises objects before persisting them:

    • Out of Process state management using the session state server (mode="StateServer") is limited to the amount of memory available to the state service.

    • Out of Process state management using SQL Server (mode="SQLServer") is bound only by the maximum size of the SQL image data type or the maximum permitted size of the database.

    Obviously there still has to be enough memory available to the worker process to be able to pull an out of session object back into memory and re-hydrate for the duration of the http request.

    As I mentioned previously, out of process state management serialises objects before persisting them.

    This means that objects must be serialisable which excludes, for example, XmlDocument or anything that inherits from MarshalByRef.

    Attempting to serialise objects of this sort will result in the following exception:

    Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable 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.

提交回复
热议问题