开发者

Needs a cause for a error in MVC

What can be the general reason behind the error below:

Error executing chil开发者_Python百科d request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'.


It sounds like you are using Html.RenderAction and the child action is throwing an exception. Try executing the child action by itself by putting its URL into your address bar.


This can happen when you have a strongly typed view:

<%@ Page Title="" Language="C#" 
    MasterPageFile="~/Views/Shared/Site.Master" 
    Inherits="System.Web.Mvc.ViewPage<CommunicationResendModel>" %>

but your controller doesn't provide a model instance:

public ActionResult Resend() {
    return View();
}

but really you should have this code:

public ActionResult Resend() {
    return View(new CommunicationResendModel());
}


I was having this problem and discovered that if you are invoking an Action which has a [HttpPost] attribute, then the Child RenderAction calls need to accept Post. When I tried to POST to one Action and then call Html.RenderAction on an Action which had [HttpGet] on it, it threw this exception.


In my case we were getting this on a production site and everything ran fine before and nothing was changed.

I changed something in the web.config(or IIsreset) to restart the app and that fixed it. Something must have gotten "hinky"<-- technical term. :)


In my case I was missing simply deploy an * stored procedure * on target who actually read data sets for "children" of my model. The error was corrected after of posting SP. This shows that the problem is not MVC, but simple deployment. Could also mean that trying to do something with a collection that does not exist.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜