我的MVC应用程序遇到一个奇怪的问题,一切正常我不知道现在这个应用程序发生了什么。我只是更新所有的nuget包。 得到以下错误
Value cannot be null or empty. Parameter name: contentPath at
错误位置
@System.Web.Optimization.Scripts.Render("~/bundles/modernizr")
@System.Web.Optimization.Scripts.Render("~/bundles/jquery")
我没有更改任何捆绑配置,我有所有必需的脚本。 这是完整的堆栈跟踪
异常:System.ArgumentException:值不能为null或为空。 参数名称:contentPath at System.Web.Mvc.UrlHelper.GenerateContentUrl(String contentPath, HttpContextBase httpContext)at System.Web.Mvc.UrlHelper.Content(String contentPath)at System.Dynamic.UpdateDelegates.UpdateAndExecute2 [T0,T1,TRET](调用点 site,T0 arg0,T1 arg1)at f:\ Sample中的ASP._Page_Views_Shared__AdminLayout_cshtml.Execute() Projects \ Notebook \ Notebook \ Views \ Shared_AdminLayout.cshtml:第23行at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,TextWriter writer,WebPageRenderingBase startPage)at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,TextWriter writer)at System.Web.WebPages.WebPageBase<> C_ DisplayClass7.b _6(TextWriter的 编写者)在System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) 在System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, HelperResult内容) System.Web.WebPages.WebPageBase.Write(HelperResult result)at System.Web.WebPages.WebPageBase.RenderSurrounding(字符串 partialViewName,Action
1 body) at System.Web.WebPages.WebPageBase.PopContext() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, 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.InvokeActionResultFilterRecursive(IList
1 filters,Int32 filterIndex,ResultExecutingContext preContext, ControllerContext controllerContext,ActionResult actionResult)at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList的1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters,Int32 filterIndex,ResultExecutingContext preContext, ControllerContext controllerContext,ActionResult actionResult)at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList
1个过滤器,ActionResult actionResult)at System.Web.Mvc.Async.AsyncControllerActionInvoker<> C_ DisplayClass21<。&以及c _DisplayClass2b.b_ 1C() 在 System.Web.Mvc.Async.AsyncControllerActionInvoker<。&以及c _DisplayClass21.b__1e(IAsyncResult的 asyncResult)
答案 0 :(得分:10)
您使用null / empty参数调用@Url.Content(ViewBag.UserImageUrl)
。
在通话前放置断点并检查ViewBag.UserImageUrl
。