ASP.NET MVC 应用程序中的错误

发布于 2024-10-10 05:10:29 字数 1754 浏览 0 评论 0原文

不断遇到这个错误

System.InvalidOperationException: The view 'Error' or its master was not found. The following locations were searched:
~/Views/Indications/Error.aspx
~/Views/Indications/Error.ascx
~/Views/Shared/Error.aspx
~/Views/Shared/Error.ascx
   at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
   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.<>c__DisplayClass8.b__4()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.b__0()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.b__7(IAsyncResult _)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

所以我们在做很多事情时 。它是随机发生的,有时会发生与我们刚刚所做的完全相同的事情而没有错误。即使我们有时在 javascript 中捕获错误,它仍然会在后端抛出此错误。有时它也会将用户导航到通用的“服务器错误”页面。

我们可以采取什么方法来处理这个问题并显示有关问题根源的一些信息?这个堆栈没有显示太多...

So we keep getting this error:

System.InvalidOperationException: The view 'Error' or its master was not found. The following locations were searched:
~/Views/Indications/Error.aspx
~/Views/Indications/Error.ascx
~/Views/Shared/Error.aspx
~/Views/Shared/Error.ascx
   at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
   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.<>c__DisplayClass8.b__4()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.b__0()
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.b__7(IAsyncResult _)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

when doing a multitude of things. It happens randomly, and sometimes happens doing the same exact thing that we just did without an error. Even when we catch an error in javascript sometimes, it still throws this error on the backend. Sometimes it navigates the user to a generic "Server Error" page as well.

What is a way we can handle this and display some information about the source of the issue? This stack isn't showing much...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

大姐,你呐 2024-10-17 05:10:29

您的操作方法(或控制器)是否设置了 [HandleError] 属性?如果是这种情况并且您没有 Error.aspx,那么您将看到此错误。如果删除 [HandleError] 属性,您将能够看到实际的错误。

Does your action method (or controller) has the [HandleError] attribute set on it? If that's the case and you don't have Error.aspx, then you will see this error. If you remove the [HandleError] attribute, you will be able to see the actual error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文