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