public IActionResult ErrorLocalDevelopment([FromServices] IWebHostEnvironment webHostEnvironment) { var context = HttpContext.Features.Get <IExceptionHandlerFeature>(); var error = context.Error; CreateBDFulling.WriteLog("Error", error.Message, error.StackTrace); return(Problem( detail: error.StackTrace, title: error.Message)); }
public async Task InvokeAsync(HttpContext httpContext) { var controllerActionDescriptor = httpContext.GetEndpoint()?.Metadata.GetMetadata <ControllerActionDescriptor>(); var Host = httpContext.Request.Host; var QueryString = httpContext.Request.QueryString; var Method = httpContext.Request.Method; var ControllerName = ""; var ActionName = ""; var RemoteIpAddress = httpContext.Connection.RemoteIpAddress; var Body = await ReadBodyFromRequest(httpContext.Request); if (controllerActionDescriptor != null) { ControllerName = controllerActionDescriptor.ControllerName; ActionName = controllerActionDescriptor.ActionName; } var message = $"Host :{Host}, QueryString : {QueryString}, Method : {Method}, ControllerName : {ControllerName}, ActionName : {ActionName}, RemoteIpAddress : {RemoteIpAddress}, Body : {Body}"; CreateBDFulling.WriteLog("Info", message); await _next(httpContext); }