循环序列化“ObjectContent`1”类型未能序列化内容类型“application/json; charset=utf-8”的响应正文。
问题:
在网上找了很多资料都没有用最终在微软官方找到该方法
解决方法:
关闭所有实体的延迟加载
通过在配置属性上设置标志,可以为上下文中的所有实体关闭延迟加载。 例如:
public class BloggingContext : DbContext
{
public BloggingContext()
{
this.Configuration.LazyLoadingEnabled = false;
}
}
相关信息可查看https://docs.microsof
原创
2021-06-19 00:47:29 ·
663 阅读 ·
0 评论