gpt4 book ai didi

asp.net-mvc - 值不能为 null 或为空。参数名称: contentPath

转载 作者:行者123 更新时间:2023-12-02 03:40:27 56 4
gpt4 key购买 nike

我的 MVC 应用程序遇到一个奇怪的问题,一切正常,我不知道这个应用程序现在发生了什么。我只是更新了所有 nuget 软件包。出现以下错误

值不能为 null 或为空。参数名称:contentPath at

错误位置


@System.Web.Optimization.Scripts.Render("~/bundles/modernizr")
@System.Web.Optimization.Scripts.Render("~/bundles/jquery")

我没有对 bundle 配置进行任何更改,并且我拥有所有必需的脚本。这是完整的堆栈跟踪

Exception: System.ArgumentException: Value cannot be null or empty. Parameter name: 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](CallSite site, T0 arg0, T1 arg1) at ASP._Page_Views_Shared__AdminLayout_cshtml.Execute() in f:\Sample Projects\Notebook\Notebook\Views\Shared_AdminLayout.cshtml:line 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 writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) at System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, HelperResult content) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 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(IList1
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 filters, ActionResult actionResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c_DisplayClass21.<>c_DisplayClass2b.b_1c() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c_DisplayClass21.b__1e(IAsyncResult asyncResult)

最佳答案

您正在使用 null/空参数调用 @Url.Content(ViewBag.UserImageUrl)

在调用之前放置一个断点并检查 ViewBag.UserImageUrl

关于asp.net-mvc - 值不能为 null 或为空。参数名称: contentPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22472243/

56 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com