line 24: <![endif]-->line 25: line 26: @Scripts.Render("~/Js/intf")line 27: <script>line 28: if (document.documentMode === 10) {
堆栈跟踪说:
[NullReferenceException: Object reference not set to an instance of an
object.] ASP._Page_VIEws_Shared__Layout_csHTML.Execute() in
c:\Users\fake\documents\Visual Studio
2013\Projects\name\name\VIEws\Shared_Layout.csHTML:26
System.Web.WebPages.WebPageBase.ExecutePageHIErarchy() +198
System.Web.Mvc.WebVIEwPage.ExecutePageHIErarchy() +104
System.Web.WebPages.WebPageBase.ExecutePageHIErarchy(WebPageContext
pageContext,TextWriter writer,WebPageRenderingBase startPage) +90
System.Web.WebPages.<>c__displayClass7.b__6(TextWriter
writer) +232 System.Web.WebPages.HelperResult.Writeto(TextWriter
writer) +10 System.Web.WebPages.WebPageBase.Write(HelperResult
result) +80
System.Web.WebPages.WebPageBase.RenderSurrounding(String
partialVIEwname,Action1 body) +63
1
System.Web.WebPages.WebPageBase.PopContext() +267
System.Web.WebPages.WebPageBase.ExecutePageHIErarchy(WebPageContext
pageContext,WebPageRenderingBase startPage) +98
System.Web.Mvc.RazorVIEw.RenderVIEw(VIEwContext vIEwContext,
TextWriter writer,Object instance) +235
System.Web.Mvc.BuildManagerCompiledVIEw.Render(VIEwContext
vIEwContext,TextWriter writer) +107
System.Web.Mvc.VIEwResultBase.ExecuteResult(ControllerContext context)
+291 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext
controllerContext,ActionResult actionResult) +13
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
filters,Int32 filterIndex,ResultExecutingContext preContext,
ControllerContext controllerContext,ActionResult actionResult) +56
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1
1 filters,ActionResult actionResult) +52
filters,ActionResult actionResult) +420
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
controllerContext,IList
System.Web.Mvc.Async.<>c__displayClass28.b__19()
+173 System.Web.Mvc.Async.<>c__displayClass1e.b__1b(IAsyncResult
asyncResult) +100
System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult
1.End() +49
asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
asyncResult) +27
System.Web.Mvc.Controller.b__1d(IAsyncResult
asyncResult,ExecuteCoreState innerState) +13
System.Web.Mvc.Async.WrappedAsyncVoID1.CallEndDelegate(IAsyncResult
1.End() +54
asyncResult) +36
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.b__15(IAsyncResult
asyncResult,Controller controller) +12
System.Web.Mvc.Async.WrappedAsyncVoID1.CallEndDelegate(IAsyncResult
1.End() +54
asyncResult) +28
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult
asyncResult) +10
System.Web.Mvc.MvcHandler.b__4(IAsyncResult
asyncResult,ProcessRequestState innerState) +21
System.Web.Mvc.Async.WrappedAsyncVoID1.CallEndDelegate(IAsyncResult
1.End() +54
asyncResult) +36
System.Web.Mvc.Async.WrappedAsyncResultBase
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
+31 System.Web.Mvc.MvcHandler.System.Web.IhttpAsyncHandler.EndProcessRequest(IAsyncResult
result) +9
System.Web.CallHandlerExecutionStep.System.Web.httpApplication.IExecutionStep.Execute()
+9688704 System.Web.httpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +155
编辑:
当你想要捆绑代码时,我把其中一个放在这里:
bundles.Add(new ScriptBundle("~/Js/intf").Include(//first internal scripts "~/Js/jquery*","~/Js/modernizr.Js","~/Js/IE-prototype-polyfill.Js","~/Js/prettyPhoto.Js"));
注意:如果我评论错误行(样式/脚本捆绑行)错误将是@ VIEwBag.Title作为新的错误!我认为Razor视图引擎在这里遇到麻烦,因为它不能实例化视图的代码要求,但为什么?
我知道使用微软技术的一些错误并不与它所说的错误有关.请给我留下你的有益经验.谢谢.
更新:
〜/ vIEws / Account / Manage.csHTML文件的简洁内容可能很有用:
@using Social.Models;@using Microsoft.AspNet.IDentity;@{ VIEwBag.Title = "manage";}<div > <div > <div > @if (VIEwBag.HasLocalPassword) { @HTML.Partial("_ChangePasswordPartial") } else { @HTML.Partial("_SetPasswordPartial") } </div> </div></div>解决方法 由于我在主版本文件中使用VIEwBag作为显示项目页面的必需变量,所以缺少初始化,让我看到这样的错误!迄今为止,我从微软开发技术中看到的一个不相干的错误之一. 总结
以上是内存溢出为你收集整理的c# – MVC5对象引用未设置为Scripts.Render上对象的实例全部内容,希望文章能够帮你解决c# – MVC5对象引用未设置为Scripts.Render上对象的实例所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)