MVC 2应用程序出错

时间:2011-03-30 16:34:32

标签: asp.net-mvc

我在我的MVC应用程序中收到以下错误,我的所有调试似乎都可以识别它的来源。我已对我在该特定页面中所做的所有更改进行了撤消操作,但仍然出现此错误。但是,我在页面中使用了相当多的隐藏字段。可能导致此错误,如果是这样,我该如何解决?

 System.Web.HttpUnhandledException was unhandled by user code
  Message="Exception of type 'System.Web.HttpUnhandledException' was thrown."
  Source="System.Web"
  ErrorCode=-2147467259
  StackTrace:
       at System.Web.UI.Page.HandleError(Exception e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)
       at System.Web.Mvc.ViewUserControl.RenderViewAndRestoreContentType(ViewPage containerPage, ViewContext viewContext)
       at System.Web.Mvc.ViewUserControl.RenderView(ViewContext viewContext)
       at System.Web.Mvc.WebFormView.RenderViewUserControl(ViewContext context, ViewUserControl control)
       at System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, ViewEngineCollection viewEngineCollection)
       at System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName, ViewDataDictionary viewData)
       at ASP.views_paymentapplications_next_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer) in c:\ProjectsVisualStudio\Projects\.NET 3.5\Pound\ExceptionManager\ExceptionManager\app\ExceptionManager.Web\Views\PaymentApplications\Next.aspx:line 39
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Control.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\ProjectsVisualStudio\Projects\.NET 3.5\Pound\ExceptionManager\ExceptionManager\app\ExceptionManager.Web\Views\Shared\Site.Master:line 466
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Control.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Page.Render(HtmlTextWriter writer)
       at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: System.NullReferenceException
       Message="Object reference not set to an instance of an object."
       Source="App_Web_lhjnw8uq"
       StackTrace:
            at ASP.views_paymentapplications_paymentapplicationform_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\ProjectsVisualStudio\Projects\.NET 3.5\Pound\ExceptionManager\ExceptionManager\app\ExceptionManager.Web\Views\PaymentApplications\PaymentApplicationForm.ascx:line 98
            at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
            at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
            at System.Web.UI.Control.Render(HtmlTextWriter writer)
            at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
            at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
            at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
            at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
            at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
            at System.Web.UI.Page.Render(HtmlTextWriter writer)
            at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
            at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
            at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
            at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
            at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       InnerException: 

1 个答案:

答案 0 :(得分:4)

发布以下堆栈跟踪中的代码:

  

的InnerException:   System.NullReferenceException   Message =“对象引用未设置为   一个对象的实例。“   Source =“App_Web_lhjnw8uq”StackTrace:   在   ASP.views_paymentapplications_paymentapplicationform_ascx._Render_control1(HtmlTextWriter的   _:w,Control parameterContainer)在c:\ ProjectsVisualStudio \ Projects.NET中   3.5 \镑\ ExceptionManager \ ExceptionManager \程序\ ExceptionManager.Web \查看\ PaymentApplications \ PaymentApplicationForm.ascx:行   98

使用我的通灵调试能力,我猜测:

您正在向RenderPartial发送一个'null'对象,并且它无法呈现部分对象。因此,检查setter是否要发送给RenderPartial,并查看它是否为null。