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

C# 访问控制器时发生堆栈溢出,c#,asp.net-mvc,entity,C#,Asp.net Mvc,Entity,在VisualStudio中创建了一个MVC/Entity项目,DB优先。创建了两个控制器,一个命名用户,另一个命名任务。任务的页面视图工作正常,但每当我尝试访问用户视图页面时,我都会遇到堆栈溢出 Application Insights Telemetry(未配置):{“name”:“Microsoft.ApplicationInsights.Dev.Request”,“time”:“2018-06-03T17:26:09.6757730Z”,“tags”:{“ai.cloud.roleIns

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

Application Insights Telemetry(未配置):{“name”:“Microsoft.ApplicationInsights.Dev.Request”,“time”:“2018-06-03T17:26:09.6757730Z”,“tags”:{“ai.cloud.roleInstance”:“DESKTOP-2V3VGT6”,“ai.operation.id”:“lH/a0kZkKsE=”,“ai.operation.name”:“GET Tasks/Index”,“ai.location.ip”::1”,“ai.internal.sdkVersion”:“web:2.5.1-195”,“ai.internal.nodeName”:”::“DESKTOP-2V3VGT6”},“data”:{“baseType”:“RequestData”,“baseData”:{“ver”:2,“id”:“lH/a0kZkKsE=.82dfa1d2”,“name”:“GET Tasks/Index”,“duration”:“00:00:04.4166410”,“success”:true,“responseCode”:“200”,“url”:“properties”:{“DeveloperMode”:“true”,“MS.ProcessedByMetricExtractors”:(name:'Requests',ver:'1.0')”}} mscorlib.dll中发生类型为“System.StackOverflowException”的未处理异常

完整跟踪地址:

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

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

为什么有两次相同的
Include
?我发布的代码是MVC模板生成的。这甚至不会编译,因为
Select
没有重载,不带参数,除非
Users1
bool
,否则lambda函数将不匹配
Where所需的
Func
The program '[7192] iisexpress.exe' has exited with code -2147023895 (0x800703e9).
public ActionResult Index()
    {
        var users = db.Users.Select().Where(u => u.Users1).ToList();
        return View(users);
    }