asp.net – 处理程序执行子请求时出错’System.Web.Mvc.HttpHandlerUtil ServerExecuteHttpHandlerAsyncWrapper’

前端之家收集整理的这篇文章主要介绍了asp.net – 处理程序执行子请求时出错’System.Web.Mvc.HttpHandlerUtil ServerExecuteHttpHandlerAsyncWrapper’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我得到以下错误

执行处理程序的子请求时出错,

System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper

在线

  1. <li>@{Html.RenderAction("CartSummary","ShoppingCart");}</li>

以上代码位于Shared / _Layout.cshtml中

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>@ViewBag.Title</title>
  5. <link href="@Url.Content("~/Content/Site.css")"
  6. rel="stylesheet"
  7. type="text/css" />
  8. <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")"
  9. type="text/javascript"></script>
  10. </head>
  11. <body>
  12. <div id="header">
  13. <h1><a href="/">ASP.NET MVC MUSIC
  14. STORE</a></h1>
  15. <ul id="navlist">
  16. <li class="first">
  17. <a href="@Url.Content("~")" id="current">
  18. Home</a></li>
  19. <li><a href="@Url.Content("~/Store/")">Store</a></li>
  20. <li>@{Html.RenderAction("CartSummary","ShoppingCart");}</li>
  21. <li><a href="@Url.Content("~/StoreManager/")">
  22. Admin</a></li>
  23. </ul>
  24. </div>
  25. @{Html.RenderAction("GenreMenu","Store");}
  26. <div id="main">
  27. @RenderBody()
  28. </div>
  29. <div id="footer">
  30. built with <a href="http://asp.net/mvc">ASP.NET MVC 3</a>
  31. </div>
  32. </body>
  33. </html>

CartSummary动作:

  1. / GET: /ShoppingCart/CartSummary
  2. [ChildActionOnly]
  3. public ActionResult CartSummary()
  4. {
  5. var cart = ShoppingCart.GetCart(this.HttpContext);
  6. ViewData["CartCount"] = cart.GetCount();
  7. return PartialView("CartSummary");
  8. }

更多说明

  1. System.Web.HttpException was unhandled by user code
  2. HResult=-2147467259
  3. Message=Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
  4. Source=System.Web
  5. ErrorCode=-2147467259
  6. WebEventCode=0
  7. StackTrace:
  8. at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,TextWriter writer,Boolean preserveForm,Boolean setPrevIoUsPage,VirtualPath path,VirtualPath filePath,String physPath,Exception error,String queryStringOverride)
  9. at System.Web.HttpServerUtility.Execute(IHttpHandler handler,Boolean setPrevIoUsPage)
  10. at System.Web.HttpServerUtility.Execute(IHttpHandler handler,Boolean preserveForm)
  11. at System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler,Boolean preserveForm)
  12. at System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper,String actionName,String controllerName,RouteValueDictionary routeValues,TextWriter textWriter)
  13. at System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper htmlHelper,String controllerName)
  14. at ASP._Page_Views_Shared__Layout_cshtml.Execute() in d:\DIL\IT\ASP.NET\MvcMusicStore2\MvcMusicStore2\Views\Shared\_Layout.cshtml:line 20
  15. at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
  16. at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
  17. at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,WebPageRenderingBase startPage)
  18. at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer)
  19. at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer)
  20. at System.Web.WebPages.WebPageBase.Write(HelperResult result)
  21. at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName,Action`1 body)
  22. at System.Web.WebPages.WebPageBase.PopContext()
  23. at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,WebPageRenderingBase startPage)
  24. at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,Object instance)
  25. at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext,TextWriter writer)
  26. at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
  27. at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,ActionResult actionResult)
  28. at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
  29. at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,ResultExecutingContext preContext,Func`1 continuation)
  30. InnerException: System.Web.HttpCompileException
  31. HResult=-2147467259
  32. Message=d:\DIL\IT\ASP.NET\MvcMusicStore2\MvcMusicStore2\Views\ShoppingCart\CartSummary.cshtml(4): error CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
  33. Source=System.Web
  34. ErrorCode=-2147467259
  35. WebEventCode=0
  36. SourceCode=#pragma checksum "D:\DIL\IT\ASP.NET\MvcMusicStore2\MvcMusicStore2\Views\ShoppingCart\CartSummary.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8F2BBF58AF78F990CB91A0CC0496EC7C5799E25F"
  37. //------------------------------------------------------------------------------
  38. // <auto-generated>
  39. // This code was generated by a tool.
  40. // Runtime Version:4.0.30319.17929
  41. //
  42. // Changes to this file may cause incorrect behavior and will be lost if
  43. // the code is regenerated.
  44. // </auto-generated>
  45. //------------------------------------------------------------------------------
  46.  
  47. namespace ASP {
  48. using System;
  49. using System.Collections.Generic;
  50. using System.IO;
  51. using System.Linq;
  52. using System.Net;
  53. using System.Web;
  54. using System.Web.Helpers;
  55. using System.Web.Security;
  56. using System.Web.UI;
  57. using System.Web.WebPages;
  58. using System.Web.Mvc;
  59. using System.Web.Mvc.Ajax;
  60. using System.Web.Mvc.Html;
  61. using System.Web.Routing;
  62.  
  63.  
  64. public class _Page_Views_ShoppingCart_CartSummary_cshtml : System.Web.Mvc.WebViewPage<dynamic> {
  65.  
  66. #line hidden
  67.  
  68.  
  69. public _Page_Views_ShoppingCart_CartSummary_cshtml() {
  70. }
  71.  
  72. protected ASP.global_asax ApplicationInstance {
  73. get {
  74. return ((ASP.global_asax)(Context.ApplicationInstance));
  75. }
  76. }
  77.  
  78. public override void Execute() {
  79.  
  80.  
  81. #line 1 "D:\DIL\IT\ASP.NET\MvcMusicStore2\MvcMusicStore2\Views\ShoppingCart\CartSummary.cshtml"
  82. Write(Html.ActionLink("Cart (" + ViewData["CartCount"] + ")","Index","ShoppingCart",new { id = "cart-status" }));
  83.  
  84.  
  85. #line default
  86. #line hidden
  87. WriteLiteral("\r\n\r\n ");
  88.  
  89.  
  90.  
  91. #line 4 "D:\DIL\IT\ASP.NET\MvcMusicStore2\MvcMusicStore2\Views\ShoppingCart\CartSummary.cshtml"
  92. Write(Html.RenderAction("CartSummary","ShoppingCart"));
  93.  
  94.  
  95. #line default
  96. #line hidden
  97. WriteLiteral(";\r\n");
  98.  
  99.  
  100. }
  101. }
  102. }
  103.  
  104. StackTrace:
  105. at System.Web.Compilation.AssemblyBuilder.Compile()
  106. at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
  107. at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
  108. at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean allowBuildInPrecompile,Boolean throwIfNotFound,Boolean ensureIsUpToDate)
  109. at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context,VirtualPath virtualPath,Boolean ensureIsUpToDate)
  110. at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,HttpContext context,Boolean throwIfNotFound)
  111. at System.Web.Compilation.BuildManager.GetObjectFactory(String virtualPath,Boolean throwIfNotFound)
  112. at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath)
  113. at System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext controllerContext,String virtualPath)
  114. at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext,List`1 locations,String name,String areaName,String cacheKey,String[]& searchedLocations)
  115. at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext,String[] locations,String[] areaLocations,String locationsPropertyName,String cacheKeyPrefix,Boolean useCache,String[]& searchedLocations)
  116. at System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext,String partialViewName,Boolean useCache)
  117. at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass8.<FindPartialView>b__7(IViewEngine e)
  118. at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup,Boolean trackSearchedPaths)
  119. at System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext,String partialViewName)
  120. at System.Web.Mvc.PartialViewResult.FindView(ControllerContext context)
  121. at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
  122. at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,ActionResult actionResult)
  123. at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
  124. at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,Func`1 continuation)
  125. at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b()
  126. at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList`1 filters,ActionResult actionResult)
  127. at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,String actionName)
  128. at System.Web.Mvc.Controller.ExecuteCore()
  129. at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
  130. at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
  131. at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
  132. at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
  133. at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
  134. at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
  135. at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
  136. at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
  137. at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
  138. at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
  139. at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
  140. at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerAsyncWrapper.<>c__DisplayClassa.<EndProcessRequest>b__9()
  141. at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.<Wrap>b__3()
  142. at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
  143. at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap(Action action)
  144. at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerAsyncWrapper.EndProcessRequest(IAsyncResult result)
  145. at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,String queryStringOverride)
  146. InnerException:

我收到另一个与此问题相关的错误

添加了这一行,这是在CartSummery.cshtml

  1. @Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",new { id = "cart-status" })
  2.  
  3. @Html.RenderAction("CartSummary","ShoppingCart");

但我有以下错误

  1. C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Routing\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Routing.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Users\W8\AppData\Local\Temp\Temporary ASP.NET Files\root\c147d7a5\1dbddebf\App_global.asax.nsxenzgx.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Abstractions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Abstractions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Helpers\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Users\W8\AppData\Local\Temp\Temporary ASP.NET Files\root\c147d7a5\1dbddebf\assembly\dl3\8a78b80f\5b89d8d7_19a3ce01\MvcMusicStore2.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Users\W8\AppData\Local\Temp\Temporary ASP.NET Files\root\c147d7a5\1dbddebf\assembly\dl3\6c65bdb8\282840f1_e09fce01\EntityFramework.dll" /out:"C:\Users\W8\AppData\Local\Temp\Temporary ASP.NET Files\root\c147d7a5\1dbddebf\App_Web_cartsummary.cshtml.fd8dc0e0.sp2ioc_m.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701;612;618 /warnaserror- "C:\Users\W8\AppData\Local\Temp\Temporary ASP.NET Files\root\c147d7a5\1dbddebf\App_Web_cartsummary.cshtml.fd8dc0e0.sp2ioc_m.0.cs" "C:\Users\W8\AppData\Local\Temp\Temporary ASP.NET Files\root\c147d7a5\1dbddebf\App_Web_cartsummary.cshtml.fd8dc0e0.sp2ioc_m.1.cs"
  2.  
  3.  
  4. Microsoft (R) Visual C# Compiler version 4.0.30319.17929
  5.  
  6. for Microsoft (R) .NET Framework 4.5
  7. Copyright (C) Microsoft Corporation. All rights reserved.
  8.  
  9. d:\DIL\IT\ASP.NET\MvcMusicStore2\MvcMusicStore2\Views\ShoppingCart\CartSummary.cshtml(3,1): error CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
  10. d:\DIL\IT\ASP.NET\MvcMusicStore2\MvcMusicStore2\Views\ShoppingCart\CartSummary.cshtml(3,7): error CS1503: Argument 1: cannot convert from 'void' to 'System.Web.WebPages.HelperResult'
  11.  
  12. Show Complete Compilation Source:

这是CartSummary.cshtml

  1. @Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",new { id = "cart-status" })
  2.  
  3. @Html.RenderAction("CartSummary","ShoppingCart");

解决方法

给定您的CartSummary部分视图,看起来您处于从局部视图调用部分视图的某种无限循环中.
  1. @Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",new { id = "cart-status" })
  2.  
  3. //if this is in CartSummary,then it is calling itself over and
  4. //over (or not at all,thus the error.)
  5. @Html.RenderAction("CartSummary","ShoppingCart");

猜你在找的asp.Net相关文章