C# – Error executing child request for handler ‘System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper’

asp.net-mvc-2ctelerik

I know that there's already some post for this particular question but I can't figure out what I'm doing wrong. The error happens on this page : http://www.gentec-eo.com/products/thz-detectors, I can't reproduce it. I recieve an email that report this error 2 to 6 times a day, I've been looking for the solution for a while but I can't figure it out. One thing to notice is that it's always from the same ip : 72.14.199.4 witch I think is a google's bot. I don't get an innerexception. My code is pretty simple, the only thing that is different from the other pages is that I use Telerik's Grid to show the data with a jQuery post action.

Here's my error :

Message : Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'.

Stack Trace : at
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler
handler, TextWriter writer, Boolean
preserveForm, Boolean setPreviousPage,
VirtualPath path, VirtualPath
filePath, String physPath, Exception
error, String queryStringOverride) at
System.Web.HttpServerUtility.Execute(IHttpHandler
handler, TextWriter writer, Boolean
preserveForm, Boolean setPreviousPage)
at
System.Web.HttpServerUtility.Execute(IHttpHandler
handler, TextWriter writer, Boolean
preserveForm) at
System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler
handler, TextWriter writer, Boolean
preserveForm) at
System.Web.Mvc.ViewPage.RenderView(ViewContext
viewContext) at
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext
context) at
System.Web.Mvc.ControllerActionInvoker.<>c_DisplayClass14.b_11()
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext
preContext, Func1 continuation) at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
controllerContext, IList
1 filters,
ActionResult actionResult) at
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName)
IP : 72.14.199.4

EDIT :
The inner exception

Message : Exception of type
'System.Web.HttpUnhandledException'
was thrown.

Stack Trace : at
System.Web.UI.Page.HandleError(Exception
e) at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequest(HttpContext
context) at
System.Web.Mvc.ViewPage.ProcessRequest(HttpContext
context) at
ASP.views_page_productcategory_aspx.ProcessRequest(HttpContext
context) at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c_DisplayClass1.b_0()
at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c_DisplayClass4.b_3()
at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1
func) at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap(Action
action) at
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler
handler, TextWriter writer, Boolean
preserveForm, Boolean setPreviousPage,
VirtualPath path, VirtualPath
filePath, String physPath, Exception
error, String queryStringOverride)

My view :

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PageModel>" %>
<%@ Import Namespace="SPK.CMS.Domain.Model"%>
<%@ Import Namespace="Web.ViewModels"%>
<%@ Import Namespace="Resources" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"><%= Model.CurrentCategory.HeadTitle %></asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="additionnalHeadElement" runat="server">
    <meta name="description" lang="fr" content="<%= Model.CurrentCategory.MetaDescription %>" />
    <meta name="keywords" lang="fr" content="<%= Model.CurrentCategory.MetaKeywords %>" />
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">

    <div id="splited-content">

        <div id="left-content">

            <% Html.RenderPartial(MVC.Shared.Views.MenuProduct); %>

      </div>

      <div id="right-content">

        <%if(!string.IsNullOrEmpty(Model.CurrentCategory.HTMLContent)){ %>
            <div id="product-cat-content"><%= Model.CurrentCategory.HTMLContent %></div>
        <%} %>

        <div id="product-compare">

            <% if (Model.CurrentCategory.FriendlyUrl.Contains("thz-detectors"))
              { %>
                <%= Html.Telerik().Grid<ProductCompare>()
                        .Name("GridTHz")
                        .Columns(colums =>
                         {
                             colums.Bound(c => c.Name).Title(Resource.MODEL).HtmlAttributes(new { @class = "center-text" }).ClientTemplate("<a href=\"" + Url.Action(MVC.Page.Product()) + "/<#=ProductName#>" + "/\" ><#=Name#></a>");
                             colums.Bound(c => c.Pmax).Title(Resource.Pmax).HeaderHtmlAttributes(new { @class = "center-text" }).ClientTemplate("<#=PmaxFormated#>");
                             colums.Bound(c => c.Pmin).Title(Resource.Pmin).HeaderHtmlAttributes(new { @class = "center-text" }).ClientTemplate("<#=PminFormated#>");
                             colums.Bound(c => c.Fmin).Title(Resource.Fmin).HeaderHtmlAttributes(new { @class = "center-text" }).ClientTemplate("<#=Fmin#> Hz");
                             colums.Bound(c => c.Fmax).Title(Resource.Fmax).HeaderHtmlAttributes(new { @class = "center-text" }).ClientTemplate("<#=Fmax#> Hz");
                             colums.Bound(c => c.AnalogOutput).Title(Resource.ANALOG_OUTPUT).HeaderHtmlAttributes(new { @class = "center-text" });
                             colums.Bound(c => c.SensorType).Title(Resource.SENSOR_TYPE).HeaderHtmlAttributes(new { @class = "center-text" });
                             colums.Bound(c => c.Surface).Title(Resource.APERTURE).HeaderHtmlAttributes(new { @class = "center-text" }).ClientTemplate("<#=Aperture#>");
                         })
                        .DataBinding(d => d.Ajax().Select("ListProductCompare", "Page", new { categoryName = Model.CurrentCategory.Name}))
                        .Sortable()
                %>    
            <%}%>

        </div>

      </div>

      <div class="clear"></div>

    </div>

<%= Html.Telerik().ScriptRegistrar().jQuery(false).DefaultGroup(g => g.DefaultPath("~/Content/javascript/2010.1.309")) %>
<script type="text/javascript">document.write(unescape('%3Cscript type="text/javascript" src="' + document.location.protocol + '//dnn506yrbagrg.cloudfront.net/pages/scripts/0010/6692.js"%3E%3C%2Fscript%3E'))</script>
</asp:Content>

My Controller'S action :

public virtual ActionResult ProductCategory(string productCategory)
{
    if (string.IsNullOrEmpty(productCategory)) return Home();
    var currentCategory = _productCatRepo.GetByUrl(productCategory);
    var pageModel = new PageModel();
    if (currentCategory == null)
    {
        return Page404();
    }
    pageModel.CurrentCategory = currentCategory;
    BuildMenusAndBreadCrumb(pageModel);
    GetHeader(pageModel, currentCategory);
    ViewData.Model = pageModel;

    return View();
}
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public virtual ActionResult ListProductCompare(string categoryName)
{

    var gridModel = new GridModel<ProductCompare>();
    gridModel.Data = _productCompareRepo.GetByCategory(categoryName);
    return View(gridModel);
}

Thanks a lot for the help!

Edited 2 :

I have an other InnerException but I still can't figure out what's my problem.

Message : Value cannot be null. Parameter name: String 

Stack Trace : at System.Number.StringToNumber(String

str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo
info, Boolean parseDecimal) at
System.Number.ParseInt32(String s,
NumberStyles style, NumberFormatInfo
info) at
System.Web.Configuration.HttpCapabilitiesBase.get_MajorVersion()
at
System.Web.HttpBrowserCapabilitiesWrapper.get_MajorVersion()
at
Telerik.Web.Mvc.Extensions.HttpRequestBaseExtensions.CanCompress(HttpRequestBase
instance) at
Telerik.Web.Mvc.UI.ScriptRegistrar.WriteScriptSources(TextWriter
writer) at
Telerik.Web.Mvc.UI.ScriptRegistrar.Write(TextWriter
writer) at
Telerik.Web.Mvc.UI.ScriptRegistrar.Render()
at
Telerik.Web.Mvc.UI.ScriptRegistrarBuilder.ToString()
at System.Web.HttpWriter.Write(Object
obj) at
System.Web.Mvc.ViewPage.SwitchWriter.Write(Object
value) at
System.Web.UI.HtmlTextWriter.Write(Object
value) at
ASP.views_page_productcategory_aspx.__RenderContent2(HtmlTextWriter
__w, Control parameterContainer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter
writer, ICollection children) at
ASP.views_shared_site_master._Render_control1(HtmlTextWriter
__w, Control parameterContainer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter
writer, ICollection children) at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter
writer, ICollection children) at
System.Web.UI.Page.Render(HtmlTextWriter
writer) at
System.Web.Mvc.ViewPage.Render(HtmlTextWriter
writer) at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)

Best Answer

Unfortunately this stack trace doesn't help pinpoint the problem. I would recommend you logging the request url and parameters that were used to cause the exception. If you are using ELMAH you already have this information and if not you could perform this easily in the Application_Error handler in Global.asax. This way you will be able to identify the exact cause and reproduce the issue.

Related Topic