zoukankan      html  css  js  c++  java
  • 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 });
            }
  • 相关阅读:
    区块链:术语
    比特币术语表
    我的友情链接
    我的友情链接
    我的友情链接
    我的友情链接
    我的友情链接
    我的友情链接
    我的友情链接
    我的友情链接
  • 原文地址:https://www.cnblogs.com/shuaimeng/p/11953061.html
Copyright © 2011-2022 走看看