WebApi Serialization Exception

SerilizationException.png
  1. Under the file of <code>XXXContext.cs</code>, and In the region of <code>Database Context</code>, append this code inside of <code>XXXContext()</code> constructor method:
    <code>base.Configuration.ProxyCreationEnabled = false;</code>

  2. Or you can Insert the following codes inside of <code>Global.asax file</code>
    <code>
    GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
    GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
    </code>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 夫妻关系重于亲子关系 九组郑州刘茜苹 写读博感受:11月3日《孩子通过伤害自己的方式来呼唤爱》 自从有...
    蓝瓷娃娃阅读 1,499评论 0 0
  • 亲爱的贝贝,你喜欢这两天在莫干山的旅行吗?我猜你应该很喜欢! 前天晚上,你和两个女孩一起在蹦床上玩游戏,你和她们一...
    lesley_75a6阅读 1,738评论 0 0

友情链接更多精彩内容