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;

Self referencing loop detected for property 错误的更多相关文章

  1. codefirst mvc Self referencing loop detected for property

    登录时,json序列化用户类时提示错误"Self referencing loop detected for property--",经过5个小时的查找,发现原因可能是,用户类包含 ...

  2. Request failed with status code 500以及自引用循环Self referencing loop detected for property ‘xx‘ with type

    错误Error: Request failed with status code 500 ,调试前端没问题,后端也没问题,还报错"连接超时" 在Network中找到错误Self r ...

  3. JSON.NET的Self referencing loop detected with type的原因以及解决办法

    模型中有循环引用是很常见的.例如,以下模型显示双向导航属性: : public class Category : { : public Category() : { : Products = new ...

  4. EF关于报错Self referencing loop detected with type的原因以及解决办法

    1)具体报错 { "Message": "出现错误.", "ExceptionMessage": "“ObjectContent` ...

  5. .NET JSON 转换 Error ” Self referencing loop detected for type“

    在进行实体转换为Json格式报错如下图: Self referencing loop detected for property 'md_agent' with type 'System.Data.E ...

  6. c# json 序列化时遇到错误 error Self referencing loop detected for type

    参考网址:http://blog.csdn.net/adenfeng/article/details/41622255 在写redis缓存帮助类的时候遇到的这个问题,本来打算先序列化一个实体为json ...

  7. Json Self referencing loop detected

    Self referencing loop detected......的错误 解决方案: 1 增加  [JsonIgnore]  过滤关联,使其不参与序列化. 这个方法简单粗暴.但是你就没办法获取关 ...

  8. Self referencing loop detected with type

    json.net namespace EFDAL{    using System;    using System.Collections.Generic;    using Newtonsoft. ...

  9. Newtonsoft.Json转换强类型DataTable错误:Self referencing loop detected with type ......

    问题,在使用Newtonsoft.Json对强类型的DataTable进行系列化时会出现循环引用错误 解决办法,不要直接系列化强类型的DataTable,改为 JsonConvert.Serializ ...

随机推荐

  1. python相关注册登录方式

    1.使用django自带功能实现登录/退出登录 使用django自带登录功能,前提生成用户(用户注册)使用的是django自带的user,或称models中用户表继承于django自带的user 1. ...

  2. 前后端分离框架前端react,后端springboot跨域问题分析

    前后端分离框架前端react,后端springboot跨域问题分析 为啥跨域了 前端react的设置 springboot后端设置 为啥跨域了 由于前后端不在一个端口上,也是属于跨域问题的一种,所以必 ...

  3. Mybateis mapper 接口 example 用法

    注意:希望通过此篇文章分享 可以使大家对mapper接口以及example 用法更加深入理解 MyBatis的Mapper接口以及Example的实例函数及详解 一.mapper接口中的方法解析 ma ...

  4. 监控服务器配置(四)-----OracleDb_exporter安装配置

    1.下载oracle客户端安装包(linux版)到 /opt/minitor/oracleDb . 下载地址:https://download.csdn.net/download/a155657721 ...

  5. 使用JFlex生成词法分析器 1:安装配置

    环境:Windows 10 STEP 1: 下载 JFlex 文件,我选择的是 jflex-1.7.0.zip.下载完成后解压到想安装的位置. 文件结构如下(假设解压目录为 C:\): C:\jfle ...

  6. 一、selenium 环境搭建

    本教程演示是在window系统上演示,linux.mac 系统以后会更新. 1.准备工作 1.python2或者python3安装包,官网:https://www.python.org/downloa ...

  7. Mysql运行状态查询命令及调优详解

    (转载自点击打开链接) MySQL运行状态及调优(一) 一.查看MySQL运行情况SHOW STATUS; 二.查看INNODB数据库引擎运行状态SHOW ENGINE INNODB STATUS; ...

  8. 用Java代码通过JDBC连接Hiveserver2

    1.在终端启动hiveserver2#hiveserver2 2.使用beeline连接hive另外打开一个终端,输入如下命令(xavierdb必须是已经存在的数据库)#beeline -u jdbc ...

  9. C#获取文件夹下面的所有文件名

    String path = @"X:\xxx\xxx";   //第一种方法 var files = Directory.GetFiles(path, "*.txt&qu ...

  10. Spring Boot jsp页面无法跳转问题

    可能的情况如下: 1.未在pom.xml中添加依赖 <!-- jsp 视图支持--> <dependency>    <groupId>org.apache.tom ...