“System.Xml.XmlDocument”无法序列化
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
遇到了同样的问题,并通过将包含 XML 文档的属性/字段标记为 NonSerialized 来解决该问题。
Had the same issue, and solved it by marking the property/field that contained the XML document as NonSerializable.