在实体对象中访问导航属性里的属性值出现异常“There is already an open DataReader associated with this Command which must be

在使用asp.net core+entity framework core时,出现上述错误,

解决方法:

修改数据库连接字符串:增加:MultipleActiveResultSets=true

"ConnectionStrings": {
    "Default": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=AlexRBAC;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;;MultipleActiveResultSets=true;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
  },

参考:

https://www.cnblogs.com/brown-birds/p/4062304.html

发布了122 篇原创文章 · 获赞 21 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/xingkongtianyuzhao/article/details/102640744
今日推荐