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

前端之家收集整理的这篇文章主要介绍了如何找到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
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的原因,前几天对应用程序产生了重大的性能影响.
原文链接:https://www.f2er.com/aspnet/245424.html

猜你在找的asp.Net相关文章