मुझे एक निराशाजनक समस्या का सामना करना पड़ रहा है। मेरी एमवीसी साइट अधिकांश भाग के लिए ठीक चलती है, लेकिन यादृच्छिक रूप से एक त्रुटि फेंकता है (जो उपयोगकर्ता को एक दोस्ताना त्रुटि दिखाती है)। मैं लॉग की जांच करते हैं, तो यह है कि मैं क्या मिलता है:अरग! System.Web.Mvc.HandleErrorInfo मेरे विचारों को क्यों पास करता है?
System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Web.Mvc.HandleErrorInfo' but this dictionary requires a model item of type 'BaseViewData'.
क्षणों बाद, एक ही उपयोगकर्ता ताज़ा और पृष्ठ लोड ठीक मारा सकता है। मैं फँस गया हूँ। ; (
अद्यतन: जोड़ा स्टैक ट्रेस
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Web.Mvc.HandleErrorInfo' but this dictionary requires a model item of type 'BaseViewData'.
at System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value)
at System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary)
at System.Web.Mvc.HtmlHelper`1..ctor(ViewContext viewContext, IViewDataContainer viewDataContainer, RouteCollection routeCollection)
at System.Web.Mvc.ViewMasterPage`1.get_Html()
at ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer)
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)
--- End of inner exception stack trace ---
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 ASP.views_shared_error_aspx.ProcessRequest(HttpContext context)
at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)
at System.Web.Mvc.WebFormView.RenderViewPage(ViewContext context, ViewPage page)
at System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
आप इसे किसी न किसी ... मैं थोड़ा इसे में खुदाई कर रहा था और मुझे लगता है कि मैं खोजने कि समस्या साइट मास्टर पेज की आवश्यकता है कि से पाने त्रुटि पृष्ठों के साथ था करने के लिए सही रास्ते पर था। कम से कम यह एक आसान फिक्स है, मैं अपने त्रुटि पृष्ठों से प्राप्त करने के लिए बस एक नया मास्टर पेज तैयार करूंगा। धन्यवाद! –
Chaddeus
आपका स्वागत है :) –
हैलो çağdaş हम उपरोक्त दिए गए समाधान को समझने और लागू करने में सक्षम नहीं हैं। क्या आप समाधान को कार्यान्वित करने के तरीके पर विस्तार से बता सकते हैं। शब्दकोश में पास किया गया मॉडल आइटम 'System.Web.Mvc.HandleErrorInfo' प्रकार का है, लेकिन इस शब्दकोश के लिए 'MAQ.Host.Models.ErrorModel' प्रकार के मॉडल आइटम की आवश्यकता होती है। System.Web.Mvc.ViewDataDictionary'1.SetModel (ऑब्जेक्ट वैल्यू) पर System.Web.Mvc.ViewDataDictionary..ctor (ViewDataDictionary शब्दकोश) पर MAQ.Host.EntityLayer.ViewBasePage'1.SetViewData (ViewDataDictionary viewData) –