我有一个例外,它只出现在生产中而非本地,
错误消息:
System.NullReferenceException:未将对象引用设置为对象的实例。在 ASP.modules_header_ascx .__ Render__control1(HtmlTextWriter __w,Control parameterContainer)at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, 在ASP.main_master .__ Renderform1(HtmlTextWriter)的ICollection儿童 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,__ w,Control parameterContainer) ICollection孩子们) System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter的 编写者)在System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter 输出)at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter的 写作者)在ASP.main_master .__ Render__control1(HtmlTextWriter __w, 控制参数容器) System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection孩子们) System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)在System.Web.UI.Page.Render(HtmlTextWriter 编写者)在System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)
和Stack Trace
at ASP.modules_header_ascx .__ Render__control1(HtmlTextWriter __w,Control parameterContainer)at at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, 在ASP.main_master .__ Renderform1(HtmlTextWriter)的ICollection儿童 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,__ w,Control parameterContainer) ICollection孩子们) System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter的 编写者)在System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter 输出)at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter的 写作者)在ASP.main_master .__ Render__control1(HtmlTextWriter __w, 控制参数容器) System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection孩子们) System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)在System.Web.UI.Page.Render(HtmlTextWriter 编写者)在System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)
此错误不包含任何代码行数或任何特定信息。
父错误消息如下:
System.Web.HttpUnhandledException:类型异常 ' System.Web.HttpUnhandledException'被扔了。 ---> System.NullReferenceException:对象引用未设置为的实例 宾语。 at ASP.modules_header_ascx .__ Render__control1(HtmlTextWriter __w, 控制参数容器) System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, 在ASP.main_master ._ Renderform1(HtmlTextWriter Control)中的ICollection> children) parameterContainer)at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection> children)在 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter> writer)at at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter输出)at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)at at ASP.main_master .__ Render__control1(HtmlTextWriter __w,Control parameterContainer)at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection> children)at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter> writer, ICollection children)在System.Web.UI.Page.Render(HtmlTextWriter> writer)at at System.Web.UI.Page.ProcessRequestMain(Boolean> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)---结束>内部异常堆栈跟踪 ---在System.Web.UI.Page.HandleError(例外e) 在System.Web.UI.Page.ProcessRequestMain(布尔值 includeStagesBeforeAsyncPoint,> Boolean includeStagesAfterAsyncPoint) 在System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, System.Web.UI.Page.ProcessRequest()中的布尔includeStagesAfterAsyncPoint) 在System.Web.UI.Page.ProcessRequest(HttpContext context)处 ASP._404_page_aspx.ProcessRequest(HttpContext context)at System.Web.HttpApplication.CallHandlerExecutionStep.System。 Web.HttpApplication。> IExecutionStep.Execute()at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)
这似乎是页面上的某些资源丢失并且调用了404页面,但是我已经检查了所有资源,包括images / css,我已经在网络中注意到,有些时候页面上的一些图像返回状态取消,
此错误在随机页面上报告,而不是每次都报告。
答案 0 :(得分:2)
老的asp.net网络表单开发者。
如果您尝试直接在客户端上访问任何服务器端控件的字段或属性,而您尝试访问的该对象为null,则很可能会收到此错误,但是不幸的是,日志确实受到限制。例如,在某些情况下,您具有一个呈现控件,并且已在aspx.cs端定义了一个属性,在getter中它返回呈现的对象。如果对象处于未呈现状态和/或为null的状态,并且希望在客户端上以<%= ThisObje.ClientID%>的形式获取该对象的客户端ID,则会收到此错误。>