WCF - 在 WCF 中保留对象引用(IIS 托管)
我正在得到
'类型的对象图 “MyCompany.MyEntity”包含循环 如果引用则无法序列化 跟踪被禁用。”请参阅 InnerException 了解更多详细信息。
当使用包含对其他对象的引用的对象调用服务时(这些对象本质上是 linq to sql 实体)。
我正在阅读这篇文章,它解释了如何在自助服务环境中保留此案例的引用: http://blogs.msdn.com/b/sowmy /archive/2006/03/26/561188.aspx
但是,我的服务必须托管在 IIS 上。如何使服务能够正确序列化实体?
I am getting the
'Object graph for type
'MyCompany.MyEntity' contains cycles
and cannot be serialized if reference
tracking is disabled.'. Please see
InnerException for more details.
when calling the service with an object that contains references to other object (those are essentially linq to sql entities).
I am reading this which explains how to enable preserving references for this case in the self hoseted service environment:
http://blogs.msdn.com/b/sowmy/archive/2006/03/26/561188.aspx
However, my service has to be hosted on IIS. How to enable the service to serialize the entites correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它比我想象的更容易,当然也更容易文章中的内容:我只是使用这个 [DataContract(IsReference=true)] 来解决问题。
It's even easier than I thought and certainly easier what's in the article: I just used this [DataContract(IsReference=true)] to fix the issue.