WCF - 在 WCF 中保留对象引用(IIS 托管)

发布于 2024-10-09 18:40:47 字数 431 浏览 0 评论 0原文

我正在得到

'类型的对象图 “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 技术交流群。

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

发布评论

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

评论(1

掩饰不了的爱 2024-10-16 18:40:47

它比我想象的更容易,当然也更容易文章中的内容:我只是使用这个 [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.

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