c# - 持久对象引用未设置错误 [无相关源行]

标签 c# asp.net-mvc

我一直在愉快地开发 MVC/Sitecore 应用程序,一切都很好。

但是突然间我收到一个错误消息,告诉我我有一个 Object reference not set to the instance of an Object继续。错误页面指向的一行除了右大括号外别无其他。

我尝试删除 View 中可能导致错误的代码行,但错误仍然存​​在于同一个右括号中。

所以我注释掉了整个 block ,包括右大括号。现在我收到以下错误:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[No relevant source lines]

Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1a47b3ff\21a05ef3\App_Web_kieomnc4.1.cs Line: 0

[NullReferenceException: Object reference not set to an instance of an object.]
ASP._Page_Views_MyCompany_Common_AddressEdit_cshtml.Execute() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1a47b3ff\21a05ef3\App_Web_pjrqnchq.1.cs:0
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +279
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +124
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +109
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +379 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +108<br/> System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890<br/> System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +97
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +879

我已完全停止 WWW 服务,关闭 Visual Studio,从临时 ASP.NET 文件夹中删除所有临时文件,重新启动服务,重新加载 Visual Studio,但错误仍然存​​在。

任何人都可以提出任何建议吗?

最佳答案

以防其他人遇到这个问题,我删除了 IIS 中的网站,然后重新创建它,错误消失了。相同位置的相同文件,仅 IIS。

关于c# - 持久对象引用未设置错误 [无相关源行],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30080980/

相关文章:

C# 柏林噪声

javascript - MVC 中的波斯日历,Asp.net

c# - 基类中的审计信息

c# - 在 ASP.NET 中使用缓存

c# - 有什么方法可以优化这个 LINQ to Entities 查询吗?

C#:是否应该在调用的方法中关闭/处置 Streams?

c# - 使用c#通过whatsapp api发送图像

asp.net-mvc - 以表单上传图像并在 MVC 4 上显示

c# - 如何在模型中设置格式DateTimeOffset?

c# - EntityFramework 级联更新