简体   繁体   English

我如何找到为什么我得到“抛出'System.Web.HttpUnhandledException'类型的异常”?

[英]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 .原来我的代码没有提取HttpUnhandledExceptionInnerException 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.我希望HttpUnhandledExceptionInnerException变得有用。

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.

相关问题 抛出异常:System.Web.dll中的“ System.Web.HttpUnhandledException” - Exception thrown: 'System.Web.HttpUnhandledException' in System.Web.dll 引发了类型为&#39;System.Web.HttpUnhandledException&#39;的异常。 在修改web.config文件时 - Exception of type 'System.Web.HttpUnhandledException' was thrown. while modifying web.config file Sys.WebForms.PageRequestManagerServerErrorException:引发了类型为&#39;System.Web.HttpUnhandledException&#39;的异常 - Sys.WebForms.PageRequestManagerServerErrorException: Exception of type 'System.Web.HttpUnhandledException' was thrown Aspdotnetstorefront System.Web.HttpUnhandledException错误 - Aspdotnetstorefront System.Web.HttpUnhandledException Error 初始化时ViewState引发System.Web.HttpUnhandledException - ViewState Throws System.Web.HttpUnhandledException When Is Initialized 为什么只有Excel 2007会引发系统异常? - Why do I get System Exception thrown only with Excel 2007? 如何找到在C#中引发的异常的异常类型? - How do I find the exception type of an exception that gets thrown in C#? 如何从CompletedEventArgs中获取抛出的异常类型? - How can I get the type of thrown exception from CompletedEventArgs? 为什么我有这个错误? 抛出异常:System.dll C# 中的“System.Net.WebException” - Why do i have this error? Exception thrown: 'System.Net.WebException' in System.dll C# 为什么运行Response.Redirect()时会出现抛出异常? - Why do I get a thrown exception when I run Response.Redirect()?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM