在视图中执行处理程序的子请求时出错 [英] Error executing child request for handler in view

查看:25
本文介绍了在视图中执行处理程序的子请求时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MVC 4 视图,我在其中呈现以下操作

I have an MVC 4 view where I render the following actions

@{
    Html.RenderAction("Index", "Logo");
    Html.RenderAction("Index", "MainMenu");
}

我的视图中有一个表单,该表单已填写并发布到控制器.在控制器中,我执行一些任务,然后将模型发送回我的视图

I have a form on my view which is filled out and posted to the controller. In the controller I perform some tasks and then send the model back to my view

[HttpPost]
public ActionResult Index(ManageAdministratorModel manageAdministratorModel)
{
     // I save some of the fields to the database here.
     return View(manageAdministratorModel);
}

当我被重定向到视图时,我收到以下错误

When I'm redirected to the view I receive the following error

执行处理程序System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper"的子请求时出错.

Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.

在这条线上

Html.RenderAction("Index", "Logo");

知道为什么会这样吗?

推荐答案

好的,我找到了问题,希望这对未来的人有所帮助.

Ok I found the problem, hopefully this will help someone in future.

每个局部视图的控制器都包含 [HttpGet] 属性.例如

The controllers for the partial views each contained the [HttpGet] attribute. For example

[HttpGet]
public ActionResult Index()
{
}

我从两个控制器中删除了属性

I remove the attribute from both controllers

public ActionResult Index()
{
}

现在一切正常.

这篇关于在视图中执行处理程序的子请求时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆