asp.net – 处理程序执行子请求时出错’System.Web.Mvc.HttpHand
发布时间:2020-12-15 23:33:53 所属栏目:asp.Net 来源:网络整理
导读:我得到以下错误: 执行处理程序的子请求时出错, System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper 在线 li@{Html.RenderAction("CartSummary","ShoppingCart");}/li 以上代码位于Shared / _Layout.cshtml中 !DOCTYPE htmlhtmlhead titl
我得到以下错误:
执行处理程序的子请求时出错,
在线 <li>@{Html.RenderAction("CartSummary","ShoppingCart");}</li> 以上代码位于Shared / _Layout.cshtml中 <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script> </head> <body> <div id="header"> <h1><a href="/">ASP.NET MVC MUSIC STORE</a></h1> <ul id="navlist"> <li class="first"> <a href="@Url.Content("~")" id="current"> Home</a></li> <li><a href="@Url.Content("~/Store/")">Store</a></li> <li>@{Html.RenderAction("CartSummary","ShoppingCart");}</li> <li><a href="@Url.Content("~/StoreManager/")"> Admin</a></li> </ul> </div> @{Html.RenderAction("GenreMenu","Store");} <div id="main"> @RenderBody() </div> <div id="footer"> built with <a href="http://asp.net/mvc">ASP.NET MVC 3</a> </div> </body> </html> CartSummary动作: / GET: /ShoppingCart/CartSummary [ChildActionOnly] public ActionResult CartSummary() { var cart = ShoppingCart.GetCart(this.HttpContext); ViewData["CartCount"] = cart.GetCount(); return PartialView("CartSummary"); } 更多说明 System.Web.HttpException was unhandled by user code HResult=-2147467259 Message=Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'. Source=System.Web ErrorCode=-2147467259 WebEventCode=0 StackTrace: 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,Boolean setPreviousPage) at System.Web.HttpServerUtility.Execute(IHttpHandler handler,Boolean preserveForm) at System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler,Boolean preserveForm) at System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper,String actionName,String controllerName,RouteValueDictionary routeValues,TextWriter textWriter) at System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper htmlHelper,String controllerName) at ASP._Page_Views_Shared__Layout_cshtml.Execute() in d:DILITASP.NETMvcMusicStore2MvcMusicStore2ViewsShared_Layout.cshtml:line 20 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,WebPageRenderingBase startPage) at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName,Action`1 body) at System.Web.WebPages.WebPageBase.PopContext() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,WebPageRenderingBase startPage) at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,Object instance) at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext,TextWriter writer) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,ResultExecutingContext preContext,Func`1 continuation) InnerException: System.Web.HttpCompileException HResult=-2147467259 Message=d:DILITASP.NETMvcMusicStore2MvcMusicStore2ViewsShoppingCartCartSummary.cshtml(4): error CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments Source=System.Web ErrorCode=-2147467259 WebEventCode=0 SourceCode=#pragma checksum "D:DILITASP.NETMvcMusicStore2MvcMusicStore2ViewsShoppingCartCartSummary.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "8F2BBF58AF78F990CB91A0CC0496EC7C5799E25F" //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace ASP { using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Web; using System.Web.Helpers; using System.Web.Security; using System.Web.UI; using System.Web.WebPages; using System.Web.Mvc; using System.Web.Mvc.Ajax; using System.Web.Mvc.Html; using System.Web.Routing; public class _Page_Views_ShoppingCart_CartSummary_cshtml : System.Web.Mvc.WebViewPage<dynamic> { #line hidden public _Page_Views_ShoppingCart_CartSummary_cshtml() { } protected ASP.global_asax ApplicationInstance { get { return ((ASP.global_asax)(Context.ApplicationInstance)); } } public override void Execute() { #line 1 "D:DILITASP.NETMvcMusicStore2MvcMusicStore2ViewsShoppingCartCartSummary.cshtml" Write(Html.ActionLink("Cart (" + ViewData["CartCount"] + ")","Index","ShoppingCart",new { id = "cart-status" })); #line default #line hidden WriteLiteral("rnrn "); #line 4 "D:DILITASP.NETMvcMusicStore2MvcMusicStore2ViewsShoppingCartCartSummary.cshtml" Write(Html.RenderAction("CartSummary","ShoppingCart")); #line default #line hidden WriteLiteral(";rn"); } } } StackTrace: at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean allowBuildInPrecompile,Boolean throwIfNotFound,Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context,VirtualPath virtualPath,Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,HttpContext context,Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetObjectFactory(String virtualPath,Boolean throwIfNotFound) at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath) at System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext controllerContext,String virtualPath) at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext,List`1 locations,String name,String areaName,String cacheKey,String[]& searchedLocations) at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext,String[] locations,String[] areaLocations,String locationsPropertyName,String cacheKeyPrefix,Boolean useCache,String[]& searchedLocations) at System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext,String partialViewName,Boolean useCache) at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass8.<FindPartialView>b__7(IViewEngine e) at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup,Boolean trackSearchedPaths) at System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext,String partialViewName) at System.Web.Mvc.PartialViewResult.FindView(ControllerContext context) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList`1 filters,ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d() at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerAsyncWrapper.<>c__DisplayClassa.<EndProcessRequest>b__9() at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.<Wrap>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.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerAsyncWrapper.EndProcessRequest(IAsyncResult result) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,String queryStringOverride) InnerException: 我收到另一个与此问题相关的错误 我添加了这一行,这是在CartSummery.cshtml @Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",new { id = "cart-status" }) @Html.RenderAction("CartSummary","ShoppingCart"); 但我有以下错误: C:Program Files (x86)Common FilesMicrosoft SharedDevServer10.0> "C:WindowsMicrosoft.NETFrameworkv4.0.30319csc.exe" /t:library /utf8output /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.Routingv4.0_4.0.0.0__31bf3856ad364e35System.Web.Routing.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Runtime.Serializationv4.0_4.0.0.0__b77a5c561934e089System.Runtime.Serialization.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.ServiceModelv4.0_4.0.0.0__b77a5c561934e089System.ServiceModel.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.Servicesv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Web.Services.dll" /R:"C:UsersW8AppDataLocalTempTemporary ASP.NET Filesrootc147d7a51dbddebfApp_global.asax.nsxenzgx.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.Abstractionsv4.0_4.0.0.0__31bf3856ad364e35System.Web.Abstractions.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.ComponentModel.DataAnnotationsv4.0_4.0.0.0__31bf3856ad364e35System.ComponentModel.DataAnnotations.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.WorkflowServicesv4.0_4.0.0.0__31bf3856ad364e35System.WorkflowServices.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystemv4.0_4.0.0.0__b77a5c561934e089System.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.WebPagesv4.0_1.0.0.0__31bf3856ad364e35System.Web.WebPages.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Xmlv4.0_4.0.0.0__b77a5c561934e089System.Xml.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.ApplicationServicesv4.0_4.0.0.0__31bf3856ad364e35System.Web.ApplicationServices.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_32System.EnterpriseServicesv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.EnterpriseServices.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.ServiceModel.Activitiesv4.0_4.0.0.0__31bf3856ad364e35System.ServiceModel.Activities.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Activitiesv4.0_4.0.0.0__31bf3856ad364e35System.Activities.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.Mvcv4.0_3.0.0.0__31bf3856ad364e35System.Web.Mvc.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.WebPages.Deploymentv4.0_2.0.0.0__31bf3856ad364e35System.Web.WebPages.Deployment.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_32System.Datav4.0_4.0.0.0__b77a5c561934e089System.Data.dll" /R:"C:WindowsMicrosoft.NETFrameworkv4.0.30319mscorlib.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Corev4.0_4.0.0.0__b77a5c561934e089System.Core.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Configurationv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILMicrosoft.CSharpv4.0_4.0.0.0__b03f5f7f11d50a3aMicrosoft.CSharp.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.Helpersv4.0_1.0.0.0__31bf3856ad364e35System.Web.Helpers.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.IdentityModelv4.0_4.0.0.0__b77a5c561934e089System.IdentityModel.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.ServiceModel.Webv4.0_4.0.0.0__31bf3856ad364e35System.ServiceModel.Web.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.ServiceModel.Activationv4.0_4.0.0.0__31bf3856ad364e35System.ServiceModel.Activation.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Drawingv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Drawing.dll" /R:"C:UsersW8AppDataLocalTempTemporary ASP.NET Filesrootc147d7a51dbddebfassemblydl38a78b80f5b89d8d7_19a3ce01MvcMusicStore2.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.DynamicDatav4.0_4.0.0.0__31bf3856ad364e35System.Web.DynamicData.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_32System.Webv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Web.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Data.DataSetExtensionsv4.0_4.0.0.0__b77a5c561934e089System.Data.DataSetExtensions.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.Extensionsv4.0_4.0.0.0__31bf3856ad364e35System.Web.Extensions.dll" /R:"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Xml.Linqv4.0_4.0.0.0__b77a5c561934e089System.Xml.Linq.dll" /R:"C:UsersW8AppDataLocalTempTemporary ASP.NET Filesrootc147d7a51dbddebfassemblydl36c65bdb8282840f1_e09fce01EntityFramework.dll" /out:"C:UsersW8AppDataLocalTempTemporary ASP.NET Filesrootc147d7a51dbddebfApp_Web_cartsummary.cshtml.fd8dc0e0.sp2ioc_m.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701;612;618 /warnaserror- "C:UsersW8AppDataLocalTempTemporary ASP.NET Filesrootc147d7a51dbddebfApp_Web_cartsummary.cshtml.fd8dc0e0.sp2ioc_m.0.cs" "C:UsersW8AppDataLocalTempTemporary ASP.NET Filesrootc147d7a51dbddebfApp_Web_cartsummary.cshtml.fd8dc0e0.sp2ioc_m.1.cs" Microsoft (R) Visual C# Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 Copyright (C) Microsoft Corporation. All rights reserved. d:DILITASP.NETMvcMusicStore2MvcMusicStore2ViewsShoppingCartCartSummary.cshtml(3,1): error CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments d:DILITASP.NETMvcMusicStore2MvcMusicStore2ViewsShoppingCartCartSummary.cshtml(3,7): error CS1503: Argument 1: cannot convert from 'void' to 'System.Web.WebPages.HelperResult' Show Complete Compilation Source: 这是CartSummary.cshtml @Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",new { id = "cart-status" }) @Html.RenderAction("CartSummary","ShoppingCart"); 解决方法
给定您的CartSummary部分视图,看起来您处于从局部视图调用部分视图的某种无限循环中.
@Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",new { id = "cart-status" }) //if this is in CartSummary,then it is calling itself over and //over (or not at all,thus the error.) @Html.RenderAction("CartSummary","ShoppingCart"); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 使用Url.action调用控制器方法时,只有第一个
- asp.net – 如何检测脚本管理器是否在页面上?
- ASP.NET Core 实现带认证功能的Web代理服务器
- 如何追踪每一笔记录的来龙去脉:一个完整的Audit Logging解
- asp.net-core – ASP.NET核心查找所有程序集中的所有类类型
- ASP.NET如何在没有最终用户删除的情况下在屏幕上编写消息?
- asp.net-mvc-4 – 当连接connecttring configSource时,Visu
- IIS 7中的虚拟目录ASP.NET网站的配置错误
- asp.net core 使用identityServer4的密码模式来进行身份认证
- .net – 列表框在autopostback上滚动到顶部
推荐文章
站长推荐
- asp.net-mvc – 任何理由不信任ASP.NET AntiForg
- asp.net-mvc – 为什么编码逗号URL?
- 在ASP.NET中导入一个类
- asp.net – 编译器失败,错误代码为-1073741819
- asp.net-mvc – 根据需要处理ASP.NET MVC可选字段
- asp.net-web-api – 如何告诉RavenDB忽略属性而不
- asp.net – 我应该如何使用Identity 2.0和WebAPI
- asp.net-mvc – asp.net mvc:如何模拟Url.Conte
- asp.net-core-mvc – 如何创建从HttpContext.Tra
- asp.net-web-api – 设置默认的WebAPI格式化程序
热点阅读