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;