MVC5:HttpServerUtility.Execute 在等待异步操作完成时被阻止。
2016-04-25 来自:闷骚客 4 人回应

在一个异步主视图渲染一个异步分部视图时提示上述错误,主视图出错位置(行2):

1 <div class="am-topbar-right">
2   @Html.Action("_Identity", "Shared")
3 </div>

主视图后台代码:

        public async Task<ActionResult> Explore()
        {
            ViewBag.LatestClasses = await base.Service.ClassService.GetEntities();
            ViewBag.RecommendedClasses = await base.Service.ClassService.SelectWhere(x => x.IsRecommend == true);
            return View();
        }

分部视图后台代码:

 1         public async Task<ActionResult> _Identity()
 2         {
 3             // 获取登录账户的班级
 4             if (Session["CurrentAccount"] != null)
 5             {
 6                 Person person = Session["CurrentAccount"] as Person;
 7                 Relation relation = (await base.Service.RelationService.SelectWhere(x => x.PersonId == person.PersonId)).FirstOrDefault();
 8                 if (relation != null)
 9                 {
10                     ViewBag.AccountClass = (await base.Service.ClassService.SelectWhere(x => x.ClassId == relation.ClassId)).FirstOrDefault();
11                 }
12             }
13             return PartialView();
14         }
2016-05-22 来自:星庐

http://www.cnblogs.com/dunitian/p/5481138.html

2016-05-01 来自:Picture

遇到过一样的问题,http://q.cnblogs.com/q/78618/ ,最后采用的解决办法是,用ajax请求这个异步action,然后填充当前视图。

2016-05-01 来自:三只青蛙

遇到过一样的问题,http://q.cnblogs.com/q/78618/

2016-04-25 来自:范范之辈

对应的英文错误信息是:

HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete.

MVC 5不支持分部视图的异步,MVC 6支持。

参考:Async PartialView causes “HttpServerUtility.Execute blocked…” exception

您的回应

你还未登陆,不能回应!登陆