无法序列化会话状态。在"状态服务器"和"SQLServer"模式下



我在应用程序中使用MySqlSQLLITE。使用SQLLITE插入数据或更新数据时,我的session值在处理查询后返回null。因此,为了克服这一点,我在Web.Config中写道

<sessionState mode="StateServer"></sessionState>

一切都工作正常,但是当进入某个页面时,我收到错误

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.

在其余页面中,每件事都运行良好,任何人都可以说出为什么会发生这种情况

听起来很明显。最大的问题是为什么您认为需要从 In-Proc 更改为其他内容。听起来您的 SQLLITE 数据库可能位于 BIN 目录中,导致应用程序每次都重新启动,但没有更多信息,谁能确定。

User答复说确实如此。

解决方案:将 SQLLITE 数据库移动到另一个目录。

相关内容

最新更新