加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

如何找到ASP.NET中的哪个对象无法序列化?

发布时间:2020-12-15 20:52:46 所属栏目:asp.Net 来源:网络整理
导读:我的应用程序中出现以下错误: 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 permit
我的应用程序中出现以下错误:

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.

堆栈跟踪未提供有关哪个对象无法序列化的任何良好信息.有没有找到问题孩子的好方法?

编辑:
我发现了这个问题,我试图序列化Linq语句(未执行).但我会尝试选择一个能够最好地解决这个问题的答案.

解决方法

实际上,您应该主要存储您自己的状态数据/对象(理想情况下建模为DTO类),在这种情况下答案是:您标记为[Serializable]或ISerializable.您不应该将原始UI控件或其他未知对象添加到会话状态.特别是出于 like this的原因,前几天对应用程序产生了重大的性能影响.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读