在 ASP.NET MVC 中抛出 OnModelCreating 类型的“System.StackOverflowException”异常

问题描述

当我想运行我的项目时,我收到了 StackOverflowException。我多次收到此错误,但过了一段时间它就消失了,直到现在我才收到它,因为我根本无法运行我的项目。我不知道为什么 Visual Studio 2019 无法运行我的项目并构建我的上下文。请注意,我有一个大型数据库,我通过“CodeFirst From Database”操作创建了我的代码优先上下文。

This is image of Error

解决方法

只需将您的方法分解为几个子方法并运行您的项目。

enter image description here

enter image description here