[英]How do I find why I get "Exception of type 'System.Web.HttpUnhandledException' was thrown"?
I'm getting我越来越
System.Web.HttpException
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'.
Stack is
at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)
at System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)
at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
and inner exception is内部异常是
System.Web.HttpUnhandledException
Exception of type 'System.Web.HttpUnhandledException' was thrown.
Stack is
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.ProcessRequest(HttpContext context)
at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context)
at System.Web.Mvc.ViewUserControl.ViewUserControlContainerPage.ProcessRequest(HttpContext context)
at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)
at System.Web.Mvc.ViewUserControl.RenderView(ViewContext viewContext)
at System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName)
at ASP.views_mycontroller_myaction_aspx.__RendermyactionContent(HtmlTextWriter __w, Control parameterContainer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at ASP.views_shared_my_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)
at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
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.ProcessRequest(HttpContext context)
at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context)
at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.<Wrap>b__3()
at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
I've seen similar stuff in many other questions and usually there's some more or less clear message from which the problem cause can be deduced.我在许多其他问题中看到了类似的东西,通常有一些或多或少明确的信息可以推断出问题的原因。
In my case there's just Exception of type 'System.Web.HttpUnhandledException' was thrown.
在我的情况下,只
Exception of type 'System.Web.HttpUnhandledException' was thrown.
How do I extract additional information from that HttpUnhandledException
to try find why it was thrown?如何从该
HttpUnhandledException
中提取其他信息以尝试找出引发它的原因?
Turns out my code was not extracting the InnerException
of that HttpUnhandledException
.原来我的代码没有提取
HttpUnhandledException
的InnerException
。 I've grabbed IIS sources (yes, they can be officially downloaded) and found that System.Web.UI.Page.HandleError(Exception e)
throws HttpUnhandledException
and passes e
into its constructor.我已经抓取了 IIS 源(是的,它们可以正式下载),发现
System.Web.UI.Page.HandleError(Exception e)
抛出HttpUnhandledException
并将e
传递给它的构造函数。 I expect that InnerException
of HttpUnhandledException
turns out useful.我希望
HttpUnhandledException
的InnerException
变得有用。
You can add this code to your error message:您可以将此代码添加到错误消息中:
errorMessage += "\n\n Inner Exception:\n\n" +ex.InnerException;
The InnerException property will give you more details about your error. InnerException 属性将为您提供有关错误的更多详细信息。
I hope it helps!我希望它有帮助!
Have you deploy your site on server, if yes then go to您是否在服务器上部署您的站点,如果是,则转到
C:\WINDOWS \Microsoft.NET\Framework \v2.0.50727\Temporary ASP.NET Files and delete your site folder. C:\WINDOWS \Microsoft.NET\Framework \v2.0.50727\Temporary ASP.NET Files 并删除您的站点文件夹。 then restart IIS.
然后重新启动 IIS。 check the application.
检查应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.