I tried handling the exception in webapi service by creating ExceptionAttribute, but looks like I am missing the reference to create the ExceptionFilterAttribute. I am getting the compiler error "type or namespace name 'HttpActionExecutedContext' could not be found" Am I missing any reference here? what is the correct way to handle exception in WebAPI in ASP.Net5? I searched in the internet but couldn't get the specific answer to asp.net5 - WebAPI
the following is the code for creating a ExceptionAttribute
using Microsoft.AspNet.Mvc.Filters; using System; using System.Net; using System.Web.Http; public class ExceptionAttribute : ExceptionFilterAttribute { public override void OnException(HttpActionExecutedContext actionExecutedContext) { HttpStatusCode status = HttpStatusCode.InternalServerError; String message = String.Empty; var exceptionType = actionExecutedContext.Exception.GetType(); ..... } }