Self referencing loop detected for property 错误

EF 序列化返回json时

报错:Self referencing loop detected for property

解决方案:在webapiconfig.cs文件中,增加设置:

  1.config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling=Newtonsoft.Json.ReferenceLoopHandling.Serializer;

  2.Config.Fomatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling=Newtonsoft.Json.preserveReferenceHandling.objects;

原文地址:https://www.cnblogs.com/marryZheng/p/8411066.html