访问控制器时发生堆栈溢出

时间:2018-06-03 17:40:35

标签: c# asp.net-mvc entity

public ActionResult Index()
{
    var users = db.Users.Include(u => u.Users1).Include(u => u.User1);
    return View(users.ToList());
}

首先在Visual Studio中创建一个MVC / Entity项目。创建了两个控制器,一个名为Users,另一个名为Tasks。任务的页面视图工作正常,但每当我尝试访问用户视图页面时,我都会遇到此堆栈溢出。

  

应用程序洞察遥测(未配置):{" name":" Microsoft.ApplicationInsights.Dev.Request"," time":" 2018- 06-03T17:26:09.6757730Z""标记" {" ai.cloud.roleInstance":" DESKTOP-2V3VGT6"" ai.operation.id":" lH / a0kZkKsE ="," ai.operation.name":" GET Tasks / Index",&#34 ; ai.location.ip":" :: 1"" ai.internal.sdkVersion":"网址:2.5.1-195",& #34; ai.internal.nodeName":" DESKTOP-2V3VGT6"}"数据" {"碱基类型":"的RequestData&#34 ;," baseData" {"版本":2" ID":" | LH / a0kZkKsE = .82dfa1d2 _"&#34 ;姓名":"获取任务/索引","持续时间":" 00:00:04.4166410","成功":真,#&34; responseCode":" 200"" URL":" http://localhost:62166/Tasks""属性&#34 ;:{" DeveloperMode":" true"," _MS.ProcessedByMetricExtractors":"(姓名:'请求',Ver: #&39; 1.0')"}}}}       未处理的类型' System.StackOverflowException'发生在mscorlib.dll

The program '[7192] iisexpress.exe' has exited with code -2147023895 (0x800703e9).

完整追踪: https://pastebin.com/raw/846WTUqE

1 个答案:

答案 0 :(得分:-2)

首先删除第二个include语句,然后查看错误是什么。如果这不起作用,你可以尝试像这样选择Where表达式。将ToList()添加到变量而不是返回。移动ToList()不会有所不同,但可以更容易调试。

Error running Gradle:
Unable to download needed Android SDK components, as the following licenses have not been accepted:
Android SDK Build-Tools 26.0.2

To resolve this, please run the following command in a Terminal:
flutter doctor --android-licenses