持久对象引用未设置错误[没有相关的源代码行]

时间:2021-09-15 16:55:40

I have been happily developing an MVC/Sitecore App and all was fine.

我一直很高兴开发一个MVC / Sitecore应用程序,一切都很好。

However all of a sudden I got an error telling me that I had a Object reference not set to the instance of an Object going on. The error page pointed to a line that had nothing other that a closing brace.

然而,突然间我得到一个错误告诉我,我的Object引用没有设置为Object的实例。错误页面指向一条没有其他结束括号的行。

I tried removing the lines of code in the view that could be causing the error but the error remained on the same closing brace.

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

So I commented out the whole block including the closing brace. Now I am getting the following error:

所以我评论了包括闭合支撑在内的整个块。现在我收到以下错误:

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.

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

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

源文件: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
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 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
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList
1 filters, ActionResult actionResult) +97
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +879

[NullReferenceException:对象引用未设置为对象的实例。]在c:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Temporary ASP.NET Files \ root \ 1a47b3ff \ 21a05ef3中的ASP._Page_Views_MyCompany_Common_AddressEdit_cshtml.Execute() 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 System.Web。 Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1过滤器,Int32 filterIndex,ResultExecutingContext preContext,ControllerContext controllerContext,ActionResult act ionResult)+890 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1过滤器,Int32 filterIndex,ResultExecutingContext preContext,ControllerContext controllerContext,ActionResult actionResult)+890 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList1 filters,ActionResult actionResult) +97 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,String actionName)+879

I have stopped the WWW service completely, closed Visual Studio, deleted all the temp files from the Temporary ASP.NET folder, restarted the service, reloaded Visual Studio but still the error remains.

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

Can anyone make any suggestions?

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

2 个解决方案

#1


In case anyone else stumbles on this, I deleted the website in IIS then recreated it and the error disappeared. Same files in the same location, just IIS.

如果其他人偶然发现,我在IIS中删除了网站,然后重新创建它,错误消失了。同一位置的相同文件,只是IIS。

#2


  1. Open IIS
  2. Stopped the IIS server
  3. 停止了IIS服务器

  4. Delete the folders under the following directory: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root
  5. 删除以下目录下的文件夹:c:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Temporary ASP.NET Files \ root

  6. Start the IIS server back up.
  7. 启动IIS服务器备份。

  8. Try loading your page again.
  9. 尝试重新加载您的页面。

#1


In case anyone else stumbles on this, I deleted the website in IIS then recreated it and the error disappeared. Same files in the same location, just IIS.

如果其他人偶然发现,我在IIS中删除了网站,然后重新创建它,错误消失了。同一位置的相同文件,只是IIS。

#2


  1. Open IIS
  2. Stopped the IIS server
  3. 停止了IIS服务器

  4. Delete the folders under the following directory: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root
  5. 删除以下目录下的文件夹:c:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Temporary ASP.NET Files \ root

  6. Start the IIS server back up.
  7. 启动IIS服务器备份。

  8. Try loading your page again.
  9. 尝试重新加载您的页面。