【问题标题】:Exception of type 'System.StackOverflowException' was thrown OnModelCreating in ASP.NET MVC在 ASP.NET MVC 中引发了 OnModelCreating 类型的“System.StackOverflowException”异常
【发布时间】:2021-04-24 07:28:11
【问题描述】:

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

This is image of Error

【问题讨论】:

    标签: asp.net asp.net-mvc stack-overflow code-first


    【解决方案1】:

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

    【讨论】:

    • 以及如何将方法分解为子方法有助于解决 StackOverflowException?
    • 如果数据库表的数量很大,实体框架生成的代码行数很大,会报错,所以应该通过拆分几个子方法来减少。跨度>
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-20
    • 2017-03-26
    • 1970-01-01
    相关资源
    最近更新 更多