Beispiel #1
0
        /// <summary>
        /// 获取IoCException
        /// </summary>
        /// <param name="context"></param>
        /// <param name="reqMsg"></param>
        /// <param name="message"></param>
        /// <param name="inner"></param>
        /// <returns></returns>
        public static IoCException GetException(OperationContext context, RequestMessage reqMsg, string message, Exception inner)
        {
            var exception = new IoCException(message, inner);

            //获取IoC异常
            return(GetException(context, reqMsg, exception));
        }
Beispiel #2
0
 /// <summary>
 /// 发送错误邮件
 /// </summary>
 /// <param name="message"></param>
 /// <param name="inner"></param>
 private void SendErrorMail(string message, Exception inner)
 {
     var appClient = new AppClient
     {
         AppName = "监控客户端",
         HostName = DnsHelper.GetHostName(),
         IPAddress = DnsHelper.GetIPAddress()
     };
     var ex = new IoCException(message, inner)
     {
         ApplicationName = appClient.AppName,
         ServiceName = "Shumi.Framework.Monitor",
         ErrorHeader = string.Format("Application【{0}】occurs error. ==> Comes from {1}({2}).", appClient.AppName, appClient.HostName, appClient.IPAddress)
     };
     SimpleLog.Instance.WriteLogWithSendMail(ex, emails);
 }
        /// <summary>
        /// 获取异常
        /// </summary>
        /// <param name="context"></param>
        /// <param name="reqMsg"></param>
        /// <param name="exception"></param>
        /// <returns></returns>
        private static IoCException GetException(OperationContext context, RequestMessage reqMsg, IoCException exception)
        {
            exception.ApplicationName = reqMsg.AppName;
            exception.ServiceName = reqMsg.ServiceName;
            exception.ErrorHeader = string.Format("App【{0}】occurs error, comes from {1}({2}).", reqMsg.AppName, reqMsg.HostName, reqMsg.IPAddress);

            //上下文不为null
            if (context != null && context.Caller != null)
            {
                var caller = context.Caller;
                if (!string.IsNullOrEmpty(caller.AppPath))
                {
                    exception.ErrorHeader = string.Format("{0}\r\nApplication Path: {1}", exception.ErrorHeader, caller.AppPath);
                }
            }

            return exception;
        }
        /// <summary>
        /// 获取IoCException
        /// </summary>
        /// <param name="context"></param>
        /// <param name="reqMsg"></param>
        /// <param name="message"></param>
        /// <param name="inner"></param>
        /// <returns></returns>
        public static IoCException GetException(OperationContext context, RequestMessage reqMsg, string message, Exception inner)
        {
            var exception = new IoCException(message, inner);

            //获取IoC异常
            return GetException(context, reqMsg, exception);
        }
Beispiel #5
0
        /// <summary>
        /// 获取异常
        /// </summary>
        /// <param name="context"></param>
        /// <param name="reqMsg"></param>
        /// <param name="exception"></param>
        /// <returns></returns>
        private static IoCException GetException(OperationContext context, RequestMessage reqMsg, IoCException exception)
        {
            exception.ApplicationName = reqMsg.AppName;
            exception.ServiceName     = reqMsg.ServiceName;
            exception.ErrorHeader     = string.Format("App【{0}】occurs error, comes from {1}({2}).", reqMsg.AppName, reqMsg.HostName, reqMsg.IPAddress);

            //上下文不为null
            if (context != null && context.Caller != null)
            {
                var caller = context.Caller;
                if (!string.IsNullOrEmpty(caller.AppPath))
                {
                    exception.ErrorHeader = string.Format("{0}\r\nApplication Path: {1}", exception.ErrorHeader, caller.AppPath);
                }
            }

            return(exception);
        }