Base solution for your next web application
Open Closed

Elmah Integration #290


User avatar
0
gvb created

hey,

I'm trying to integrate Elmah, Elmah MVC, Elmah Contrib WebApi.

My probleme is coming from MVC part, it register my error and it register an other from ABP but the WebApi part work perfectly.

Does someone know how to fix this ? Here is the error :

The model item passed into the dictionary is of type 'System.Web.Mvc.HandleErrorInfo', but this dictionary requires a model item of type 'Abp.Web.Mvc.Models.ErrorViewModel'.

The stack trace :

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 'Abp.Web.Mvc.Models.ErrorViewModel'.
   at System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value)
   at System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary)
   at System.Web.Mvc.WebViewPage`1.SetViewData(ViewDataDictionary viewData)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.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.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`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)

thx in advance :)

EDIT: Just to tell, my error is handled correctly by Elmah MVC but i feel that i shouldn't receive an other error in the same time ;) that tell me that i require an Abp.Web.Mvc.Models.ErrorViewModel or tell me if i can switch this somewhere in the application! :)


4 Answer(s)
  • User Avatar
    0
    gvb created

    I found that the error come from Error.cshtml

    But i don't really know how this view is working really... it never appeared on any page!

    so how does it work, how do i make it appear!

    thx

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    When an error occurs in an MVC action (and the request is not AJAX), then ABP handles the exception, creates an Abp.Web.Mvc.Models.ErrorViewModel object and passes it to the _Error.cshtml view. I don't know ElMah. Maybe it also uses the same view with a different model.

  • User Avatar
    0
    gvb created

    Yea, it use the same mechanic.

    how can i disable it in ABP ?

  • User Avatar
    0
    hikalkan created
    Support Team

    As I see, it's not possible (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Mvc/Web/Mvc/Controllers/AbpHandleErrorAttribute.cs">https://github.com/aspnetboilerplate/as ... tribute.cs</a>)

    You can create an issue on Github to provide an option for that.