• 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 });
            }
  • 相关阅读:
    HTML_表单
    jabc_DAO
    JDBC 加钱减钱
    JDBC 连接池
    JDBC
    视图序列索引
    【Java8】 lambda 特性讲解
    IntelliJ IDEA 常用快捷键
    Java IO 之 装饰模式
    Java IO 讲解
  • 原文地址:https://www.cnblogs.com/shuaimeng/p/11953061.html
Copyright © 2020-2023  润新知