在实体对象中访问导航属性里的属性值出现异常“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

posted @ 2019-10-19 17:16  星空天宇  阅读(127)  评论(0编辑  收藏  举报