“System.Xml.XmlDocument”无法序列化

发布于 2024-11-18 18:00:57 字数 223 浏览 3 评论 0原文

我在 C# 应用程序中使用 AppFabric 缓存。我尝试缓存 XmlDocument 但出现以下错误:

无法序列化类型“System.Xml.XmlDocument”。请考虑使用 DataContractAttribute 属性标记它,并使用 DataMemberAttribute 属性标记要序列化的所有成员。

我该如何解决这个问题?

I am using AppFabric caching in my C# application. I am attempting to cache a XmlDocument but getting the following error:

Type 'System.Xml.XmlDocument' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.

How can I resolve this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

待"谢繁草 2024-11-25 18:00:57

遇到了同样的问题,并通过将包含 XML 文档的属性/字段标记为 NonSerialized 来解决该问题。

Had the same issue, and solved it by marking the property/field that contained the XML document as NonSerializable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文