public async Task InvokeAsync(HttpContext context) { try { await _next(context); } catch (Exception ex) { using (_logger.FormContext(ContextKeys.CORRELATIONID, Convert.ToString(context.Items[ContextKeys.CORRELATIONID]))) { using (_logger.FormContext(ContextKeys.MethodName, context.Request.Path)) { _logger.LogError(ex.Message, ex); } } await HandleExceptionAsync(ex, context); } }