core直接获取报异常数据
报异常直接跳转到/Home/Error
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { var _IExceptionHandlerFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>(); var _Exception = _IExceptionHandlerFeature?.Error; sys_Log errorlog = new sys_Log(); errorlog.gid = new Guid(); errorlog.IpAddress = HttpContext.Connection.RemoteIpAddress.ToString(); errorlog.PageUrl = _IExceptionHandlerFeature.Path; errorlog.ShortMessage = _Exception.Message; errorlog.FullMessage = _Exception.StackTrace; errorlog.userName = _account.UserName; errorlog.createTime = DateTime.Now; _logService.AddLog(errorlog); return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); }