gpt4 book ai didi

.net - 如何在 ASP.NET 中找到无法序列化的对象?

转载 作者:行者123 更新时间:2023-12-03 22:28:14 26 4
gpt4 key购买 nike

我的应用程序中出现以下错误:

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.



堆栈跟踪没有提供关于哪个对象无法序列化的任何好的信息。有没有找到问题 child 的好方法?

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

最佳答案

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

关于.net - 如何在 ASP.NET 中找到无法序列化的对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1772854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com