更新包后,对象引用未设置为_Layout.cshtml中的对象实例 - c#

在我通过以下方式更新所有NuGet软件包之前,项目运行良好
NuGet Manager(我正在尝试获取最新的OWIN软件包)。

此错误在_Layout.cshtml中,我完全没有涉及。

你调用的对象是空的。

说明:在执行期间发生未处理的异常
当前的Web请求。请查看堆栈跟踪以获取更多信息
有关错误及其在代码中起源的信息。

异常详细信息:System.NullReferenceException:没有对象引用
设置为对象的实例。

源错误:

Line 13:  
Line 14:     <!-- Custom Fonts -->
Line 15:     @Scripts.Render("~/Content/fonts")

源文件:f:\ Workplace \ lrc \ lrc \ Views \ Shared_Layout.cshtml行:
15

更新资料

这是_Layout.cshtml中的代码(它们在创建项目时自动生成)

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="LRC - We are aiming at building up a healthier life style.">
    <meta name="author" content="Winston Fan">
    <title>@ViewBag.Title - LRC</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")


    <!-- Custom Fonts -->

        @Scripts.Render("~/Content/fonts")

    <link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">

所以它抱怨这行代码:
@ Scripts.Render(“〜/ Content / fonts”)

但是正如您所看到的,这是VS生成的代码,我怎么能弄错呢?

我还检查了Conntent / font-awesome / fonts文件夹中的内容,所有必需的资源都在那里。

这是BundleConfig内部的代码(也是自动生成的代码)

bundles.Add(new ScriptBundle("~/Content/fonts").Include(
              "~/Content/font-awesome/fonts/fontawesome-*",
              "~/Content/font-awesome/fonts/FontAwesome.otf"));

我的Microsoft.OWin.Security,Microsoft.OWin.Security.Google和Microsoft.OWin版本是3.0.1.0

更新2

这是堆栈跟踪:

堆栈跟踪:

[NullReferenceException:对象引用未设置为的实例
对象。] Microsoft.Ajax.Utilities.JSParser.ParseExpression(AstNode
leftHandSide,布尔单值,布尔bCanAssign,JSToken inToken)
+1007 Microsoft.Ajax.Utilities.JSParser.ParseExpressionStatement(布尔
fSourceElement)+268
Microsoft.Ajax.Utilities.JSParser.ParseStatement(布尔
fSourceElement,布尔skipImportantComment)+1552
Microsoft.Ajax.Utilities.JSParser.ParseBlock()+164
Microsoft.Ajax.Utilities.JSParser.ParseStatement(布尔
fSourceElement,布尔skipImportantComment)+498
Microsoft.Ajax.Utilities.JSParser.ParseBlock()+164
Microsoft.Ajax.Utilities.JSParser.ParseStatement(布尔
fSourceElement,布尔skipImportantComment)+498
Microsoft.Ajax.Utilities.JSParser.ParseBlock()+164
Microsoft.Ajax.Utilities.JSParser.ParseStatement(布尔
fSourceElement,布尔skipImportantComment)+498
Microsoft.Ajax.Utilities.JSParser.ParseStatements(块)+159
Microsoft.Ajax.Utilities.JSParser.InternalParse()+1011
Microsoft.Ajax.Utilities.JSParser.Parse(DocumentContext sourceContext)
+123 Microsoft.Ajax.Utilities.JSParser.Parse(DocumentContext sourceContext,CodeSettings设置)+54
Microsoft.Ajax.Utilities.Minifier.MinifyJavaScript(字符串源,
CodeSettings代码设置)+987
System.Web.Optimization.JsMinify.Process(BundleContext上下文,
BundleResponse响应)+310
System.Web.Optimization.Bundle.ApplyTransforms(BundleContext上下文,
字符串bundleContent,IEnumerable 1 bundleFiles) +263
System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext
context) +355
System.Web.Optimization.Bundle.GetBundleResponse(BundleContext
context) +104
System.Web.Optimization.BundleResolver.GetBundleContents(String
virtualPath) +254
System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable
1
资产)+252
System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat,
字符串[]路径)+75
System.Web.Optimization.Scripts.RenderFormat(String tagFormat,
字符串[]路径)+292
System.Web.Optimization.Scripts.Render(String []路径)+51
中的ASP._Page_Views_Shared__Layout_cshtml.Execute()
f:\ Workplace \ lrc \ lrc \ Views \ Shared_Layout.cshtml:15
System.Web.WebPages.WebPageBase.ExecutePageHierarchy()+271
System.Web.Mvc.WebViewPage.ExecutePageHierarchy()+121
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext,TextWriter编写器,WebPageRenderingBase startPage)+145
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext,TextWriter作家)+41
System.Web.WebPages。 c__DisplayClass3.b__2(TextWriter
作家)+335 System.Web.WebPages.HelperResult.WriteTo(TextWriter
作家)+42
System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer,
HelperResult内容)+45
System.Web.WebPages.WebPageBase.Write(HelperResult结果)+53
System.Web.WebPages.WebPageBase.RenderSurrounding(String
partialViewName,动作1 body) +178
System.Web.WebPages.WebPageBase.PopContext() +229
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) +154
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,
TextWriter writer, Object instance) +695
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext
viewContext, TextWriter writer) +382
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
+431 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext
controllerContext, ActionResult actionResult) +39
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1
过滤器,Int32 filterIndex,ResultExecutingContext preContext,
ControllerContext controllerContext,ActionResult actionResult)+116
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList 1
filters, Int32 filterIndex, ResultExecutingContext preContext,
ControllerContext controllerContext, ActionResult actionResult) +529
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
controllerContext, IList
1个过滤器,ActionResult actionResult)+106
System.Web.Mvc.Async。 c__DisplayClass2b.b__1c()
+321 System.Web.Mvc.Async。 c__DisplayClass21.b__1e(IAsyncResult
asyncResult)+185
System.Web.Mvc.Async.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult
asyncResult) +42
System.Web.Mvc.Async.WrappedAsyncResultBase
1.End()+133
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
对象标签)+56
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
asyncResult)+40
System.Web.Mvc.Controller.b__1d(IAsyncResult
asyncResult,ExecuteCoreState innerState)+34
System.Web.Mvc.Async.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult
asyncResult) +70
System.Web.Mvc.Async.WrappedAsyncResultBase
1.End()+139
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
对象标签)+59
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
对象标签)+40
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+44
System.Web.Mvc.Controller.b__15(IAsyncResult
asyncResult,控制器控制器)+39
System.Web.Mvc.Async.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult
asyncResult) +62
System.Web.Mvc.Async.WrappedAsyncResultBase
1.End()+139
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
对象标签)+59
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
对象标记)+40 System.Web.Mvc.Controller.EndExecute(IAsyncResult
asyncResult)+39
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult
asyncResult)+39
System.Web.Mvc.MvcHandler.b__5(IAsyncResult
asyncResult,ProcessRequestState innerState)+39
System.Web.Mvc.Async.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult
asyncResult) +70
System.Web.Mvc.Async.WrappedAsyncResultBase
1.End()+139
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
对象标签)+59
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
对象标签)+40
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
+40 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
结果)+38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+932 System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值并已完成)+188

更新3

这是内容文件夹。

更新4

这是packages.config的内容

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.5.0.2" targetFramework="net451" />
  <package id="bootstrap" version="3.3.4" targetFramework="net451" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net451" />
  <package id="jQuery" version="2.1.3" targetFramework="net451" />
  <package id="jQuery.Validation" version="1.13.1" targetFramework="net451" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net451" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net451" />
  <package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net451" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net451" />
  <package id="Microsoft.Owin" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net451" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
  <package id="Modernizr" version="2.8.3" targetFramework="net451" />
  <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
  <package id="Owin" version="1.0" targetFramework="net451" />
  <package id="Respond" version="1.4.2" targetFramework="net451" />
  <package id="WebGrease" version="1.6.0" targetFramework="net451" />
</packages>

参考方案

检查javascript是否有错误。我的是半写的行,以“功能”结尾

如何从php中获取datatables jQuery插件的json数据 - php

我是PHP的新手,正在尝试使用Datatables jQuery插件。我知道我必须从.php文件中获取数据,然后在数据表中使用它,但是我似乎无法通过ajax将其传递给数据表。我设法从数据库中获取数据,并对其进行json编码,但是后来我不知道如何在我的index.php文件中调用它,并在其中显示它。我究竟做错了什么?这是我的代码:HTML(已编辑): <…

当回复有时是一个对象有时是一个数组时,如何在使用改造时解析JSON回复? - java

我正在使用Retrofit来获取JSON答复。这是我实施的一部分-@GET("/api/report/list") Observable<Bills> listBill(@Query("employee_id") String employeeID); 而条例草案类是-public static class…

改造正在返回一个空的响应主体 - java

我正在尝试使用Retrofit和Gson解析一些JSON。但是,我得到的响应机构是空的。当我尝试从对象中打印信息时,出现NullPointerException。我确保URL正确,并且我也确保POJO也正确。我正在使用jsonschema2pojo来帮助创建POJO类。这是我要解析的JSON{ "?xml": { "@versi…

每个文件合并后添加换行 - python

我有很多类似以下内容的JSON文件:例如。1.json{"name": "one", "description": "testDescription...", "comment": ""} test.json{"name"…

Json到php,json_decode返回NULL - php

我正在用PHP进行JSON解析器的一些API,用于存储有关遗产的信息。我在解析时遇到问题,因为它返回的是NULL值而不是数组或对象。简单的JSON代码可以很好地解析,但是可以这样:{"success":true,"totalCount":1,"data":[{"id":99694…