コード例 #1
0
 public BaseConfigInfo GetBaseConfig()
 {
     try
     {
         return(BaseConfigs.GetBaseConfig());
     }
     catch (Exception ex)
     {
         string source = "We7.CMS.Install-InstallWebService—GetBaseconfig";
         EventLogHelper.WriteToLog(source, ex, EventLogEntryType.Error);
         throw ex;
     }
 }
コード例 #2
0
 ///<summary>
 /// Initialize the global inversion of control reference with the <paramref name="sectionName"/>.
 /// <see cref="IoC"/> allows us to drop in a different inversion of control container
 /// that will vary between different companies' implementations of the gateway and agent.
 ///</summary>
 ///<param name="sectionName">The container to use as the resolver</param>
 ///<returns>Returns a reference to the resolver so it can be used in method chaining.</returns>
 ///<exception cref="ArgumentNullException">Throw if <paramref name="sectionName"/> was null</exception>
 public static IDependencyResolver Initialize(string sectionName)
 {
     try
     {
         IocContainerSection  section   = IocContainerSection.Load(sectionName);
         IDependencyContainer container = section.CreateContainer();
         return(container.RegisterFromConfig());
     }
     catch (Exception ex)
     {
         EventLogHelper.WriteError("While initializing container", ex.ToString());
         throw;
     }
 }
コード例 #3
0
        private void OnDeleteConfiguration(BaseMessage <DeleteConfigurationInfo> pRequest)
        {
            var con = _configurations.FirstOrDefault(pX => pX.ConfigurationName == pRequest.Data.Name);

            if (con != null)
            {
                con.Delete();
                SendConfigurations();
            }
            else
            {
                EventLogHelper.LogEvent("Error deleting configuration as it does not exist: " + pRequest.Data.Name);
            }
        }
        /// <summary>运行</summary>
        public void Run()
        {
            if (running)
            {
                return;
            }

            try
            {
                running = true;

                // 开始时间
                TimeSpan beginTimeSpan = new TimeSpan(DateTime.Now.Ticks);

                ServiceTrace.Instance.WriteLine("正在清理帐号与组织的过期关系信息。");

                // MembershipManagement.Instance.OrganizationService.ClearupAllRelation();

                ServiceTrace.Instance.WriteLine("正在清理人员与角色的过期关系信息。");

                // MembershipManagement.Instance.RoleService.ClearupAllRelation();

                ServiceTrace.Instance.WriteLine("正在清理人员与群组的过期关系信息。");

                // MembershipManagement.Instance.GroupService.ClearupAllRelation();

                ServiceTrace.Instance.WriteLine("已成功清理人员的全部过期关系信息。");

                // 结束时间
                TimeSpan endTimeSpan = new TimeSpan(DateTime.Now.Ticks);

                ServiceTrace.Instance.WriteLine(string.Format("共耗时{0}秒。",
                                                              beginTimeSpan.Subtract(endTimeSpan).Duration().TotalSeconds));

                // 3.设置下一次运行的时间(每隔一天)
                this.nextRunTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + this.nextRunTime.ToString("HH:mm:00")).AddDays(1);

                running = false;
            }
            catch (Exception ex)
            {
                // 发生异常是, 记录异常信息  并把运行标识为false.

                ServiceTrace.Instance.WriteLine(ex.ToString());

                EventLogHelper.Write(string.Format("{0} 监听器发生异常信息\r\n{1}。", this.Name, ex));

                running = false;
            }
        }
コード例 #5
0
        private void OnSetConfigurationCertificate(BaseMessage <SetConfigurationCertificateInfo> pRequest)
        {
            var con = _configurations.FirstOrDefault(pX => pX.ConfigurationName == pRequest.Data.Name);

            if (con != null)
            {
                con.SetCertificate(pRequest);
                SendConfigurations();
            }
            else
            {
                EventLogHelper.LogEvent("Error setting configuration cert as it does not exist: " + pRequest.Data.Name);
            }
        }
コード例 #6
0
 public static void DisposeRunspace()
 {
     PsRunspace.Dispose();
     PsRunspace = null;
     PsRunspace = RunspaceFactory.CreateRunspace(RunspaceConfiguration);
     try
     {
         PsRunspace.Open();
     }
     catch (Exception ex)
     {
         EventLogHelper.WriteToEventLog(Config.ServiceName, 2, "Error initializing runspace: " + ex.Message);
     }
     EventLogHelper.WriteToEventLog(Config.ServiceName, 1, "PowerShell Runspace is disposed." + Environment.NewLine + "All previously definied PS objects are garbage collected.");
 }
コード例 #7
0
        /// <summary>运行</summary>
        public void Run()
        {
            if (running)
            {
                return;
            }

            try
            {
                running = true;

                // 开始时间
                TimeSpan beginTimeSpan = new TimeSpan(DateTime.Now.Ticks);

                ServiceTrace.Instance.WriteLine("正在设置帐号状态。");

                // 1.从组织架构获取项目信息
                // IList<ProjectInfo> list = ProjectsContext.Instance.ProjectService.TryFetchNewProjectsFromMemebership();

                //// 2.根据组织架构同步项目信息
                //foreach (ProjectInfo item in list)
                //{
                //    ProjectsContext.Instance.ProjectService.SyncProjectFromMemebership(item.Id);
                //}

                ServiceTrace.Instance.WriteLine("已成功同步组织架构中的项目信息。");

                // 结束时间
                TimeSpan endTimeSpan = new TimeSpan(DateTime.Now.Ticks);

                ServiceTrace.Instance.WriteLine(string.Format("共耗时{0}秒。", beginTimeSpan.Subtract(endTimeSpan).Duration().TotalSeconds));

                // 3.设置下一次运行的时间(每隔一天)
                this.nextRunTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + this.nextRunTime.ToString("HH:mm:00")).AddDays(1);

                running = false;
            }
            catch (Exception ex)
            {
                // 发生异常是, 记录异常信息  并把运行标识为false.

                ServiceTrace.Instance.WriteLine(ex.ToString());

                EventLogHelper.Write(string.Format("{0} 监听器发生异常信息\r\n{1}。", this.Name, ex));

                running = false;
            }
        }
コード例 #8
0
    /// <summary>
    /// Returns system information.
    /// </summary>
    private static string GetSystemInformation()
    {
        StringBuilder sb = new StringBuilder();

        sb.AppendFormat("CMS version: {0} Build: {1}",
                        CMSVersion.MainVersion,
                        CMSVersion.GetVersion(true, true, true, true));
        sb.AppendLine();

        sb.AppendFormat("OS version: {0}", Environment.OSVersion);
        sb.AppendLine();

        LicenseKeyInfo licenseKey = null;

        if (SiteContext.CurrentSite != null)
        {
            licenseKey = LicenseKeyInfoProvider.GetLicenseKeyInfo(SiteContext.CurrentSite.DomainName);
        }

        if (licenseKey != null)
        {
            sb.AppendFormat("License info: {0}, {1}, {2}, {3}",
                            licenseKey.Domain,
                            licenseKey.Edition,
                            licenseKey.ExpirationDateReal.ToString(DateTimeHelper.DefaultIFormatProvider),
                            licenseKey.Version);

            string packages = ValidationHelper.GetString(licenseKey.GetValue("LicensePackages"), string.Empty);
            if (!string.IsNullOrEmpty(packages))
            {
                sb.AppendFormat(", {0}", packages);
            }
        }

        int eventId = QueryHelper.GetInteger("eventid", 0);

        if (eventId > 0)
        {
            EventLogInfo ev = EventLogProvider.GetEventLogInfo(eventId);
            if (ev != null)
            {
                sb.AppendLine();
                sb.Append(HttpUtility.HtmlDecode(EventLogHelper.GetEventText(ev)));
            }
        }

        return(sb.ToString());
    }
コード例 #9
0
        public static string Ping()
        {
            // Add verbose log
            EventLogHelper.Write_Verbose("Inside SolrWrapper.Ping() method");

            // Need to have a core to monitor/ping
            if ((ServiceSettings.Monitor.Cores == null) || (ServiceSettings.Monitor.Cores.Count == 0))
            {
                EventLogHelper.Write_Error(ServiceSettings.Logging.FailedPingEventId, "No core found to monitor, so no core to ping.\n\nUpdate the app.config Monitor.Cores value.");
                return("Service Configuration Error");
            }

            // Get the ping information
            string ping_url = "http://*****:*****@name='status']").InnerText;

                EventLogHelper.Write_Verbose("Parsed the XML and received a status of '" + status + "'");
                return(status);
            }
            catch (Exception ee)
            {
                EventLogHelper.Write_Error(ServiceSettings.Logging.ExceptionEventId,
                                           "EXCEPTION caught in SolrWrapper.Ping() conversting response to a XML document and reading the status.\n\n--------------------\n\nRESPONSE:\n\n" +
                                           response, ee);
                return(null);
            }
        }
コード例 #10
0
    /// <summary>
    /// Handles clear button action.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        if (e.CommandName.Equals("clear", StringComparison.InvariantCultureIgnoreCase))
        {
            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.EventLog", "ClearLog"))
            {
                RedirectToAccessDenied("CMS.EventLog", "ClearLog");
            }

            UserInfo ui = MembershipContext.AuthenticatedUser;

            // Deletes event logs of specific site from DB
            EventLogHelper.ClearEventLog(ui.UserID, ui.UserName, RequestContext.UserHostAddress, siteID);

            eventLog.ReloadData();
        }
    }
コード例 #11
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Initialize filter dropdownlist
        if (!RequestHelper.IsPostBack())
        {
            if (drpType.Items.Count <= 0)
            {
                drpType.Items.Add(new ListItem(GetString("general.selectall"), ""));
                foreach (string eventType in new string[] { "e", "i", "w" })
                {
                    drpType.Items.Add(new ListItem(EventLogHelper.GetEventTypeText(eventType), eventType));
                }
            }
            this.drpType.SelectedValue = mSelectedValue;
        }
    }
コード例 #12
0
        /// <summary>
        /// 获取配置信息,返回整形
        /// </summary>
        public static int GetConfigInt(string key)
        {
            int    num          = 0;
            string configString = GetConfig(key);

            if ((configString != null) && (string.Empty != configString))
            {
                try
                {
                    num = int.Parse(configString);
                }
                catch (Exception ex)
                {
                    EventLogHelper.WriteEventLog(ex.ToString());
                }
            }
            return(num);
        }
コード例 #13
0
        /// <summary>
        /// 获取配置信息,返回布尔型
        /// </summary>
        public static bool GetConfigBool(string key)
        {
            bool   flag         = false;
            string configString = GetConfig(key);

            if (!string.IsNullOrEmpty(configString))
            {
                try
                {
                    flag = bool.Parse(configString);
                }
                catch (Exception ex)
                {
                    EventLogHelper.WriteEventLog(ex.ToString());
                }
            }
            return(flag);
        }
コード例 #14
0
        public static BadRequestObjectResult BadRequest(this Controller controller, string errorMessage)
        {
            string controllerName = controller.ControllerContext.RouteData.Values["controller"].ToString();
            string action         = controller.ControllerContext.RouteData.Values["action"].ToString();

            EventLogHelper.Error(_eventLogger, new EventLog
            {
                EventGuid   = Guid.NewGuid(),
                Action      = action,
                Application = "ESS",
                EventDate   = DateTime.UtcNow,
                Message     = errorMessage,
                Resource    = controllerName,
                StackTrace  = null,
                UserGuid    = UserHelper.CurrentUserGuid(controller.HttpContext)
            });
            return(controller.BadRequest(errorMessage));
        }
コード例 #15
0
        /// <summary>
        /// 获取配置信息,返回数字
        /// </summary>
        public static decimal GetConfigDecimal(string key)
        {
            decimal num          = 0M;
            string  configString = GetConfig(key);

            if ((configString != null) && (string.Empty != configString))
            {
                try
                {
                    num = decimal.Parse(configString);
                }
                catch (Exception ex)
                {
                    EventLogHelper.WriteEventLog(ex.ToString());
                }
            }
            return(num);
        }
コード例 #16
0
 [SoapHeader("header")] //用户身份验证的soap header
 public BaseConfigInfo GetBaseConfig()
 {
     //验证是否有权访问(当然,也可以通过查询数据库实现,具体视项目要求)
     if (!CheckAdmin(header.UserName, header.PassWord))
     {
         throw new Exception("无权使用此服务");
     }
     try
     {
         return(BaseConfigs.GetBaseConfig());
     }
     catch (Exception ex)
     {
         string source = "We7.CMS.Install-InstallWebService—GetBaseconfig";
         EventLogHelper.WriteToLog(source, ex, EventLogEntryType.Error);
         throw ex;
     }
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: rvanderbrugge/blu
        static void Main(string[] args)
        {
            InputArguments inputArguments = new InputArguments(args);
            string         scriptBlock    = String.Empty;

            if (!string.IsNullOrEmpty(inputArguments["-Command"]))
            {
                scriptBlock = inputArguments["-Command"];
            }
            else if (!string.IsNullOrEmpty(inputArguments["-Define"]))
            {
                scriptBlock = inputArguments["-Define"].TransformForBlu();
            }
            else if (!string.IsNullOrEmpty(inputArguments["-Execute"]))
            {
                // TODO
            }
            else
            {
                Console.WriteLine("BluSheel needs to be executed with -Command or -Define or -Execute parameters.");
                Environment.Exit(1);
            }

            try
            {
                IpcClient  ipcClient = new IpcClient(".", "BluPowerShell");
                PipeStream pipe      = ipcClient.Connect(1);
                Byte[]     output    = Encoding.UTF8.GetBytes(scriptBlock);
                pipe.Write(output, 0, output.Length);

                // Read the result
                Byte[] data      = new Byte[IpcClient.ClientInBufferSize];
                Int32  bytesRead = pipe.Read(data, 0, data.Length);
                ExitHandler(Encoding.UTF8.GetString(data, 0, bytesRead));

                // Done with pipe
                pipe.Close();
            }
            catch (Exception ex)
            {
                EventLogHelper.WriteToEventLog(Config.ShellName, 2, "Exception in send/recieve script block: " + Environment.NewLine + ex.Message);
                Environment.Exit(1);
            }
        }
コード例 #18
0
 public string CopyTableDataFromCloneSite(string fromPath, string toPath, List <string> tables)
 {
     try
     {
         string         xmlPath   = Path.Combine(toPath, "App_Data\\XML");
         BaseConfigInfo oldConfig = BaseConfigs.Deserialize(Path.Combine(fromPath, "config\\db.config"));
         oldConfig.DBConnectionString = oldConfig.DBConnectionString.Replace("{$App}", fromPath);
         BaseConfigInfo newConfig = BaseConfigs.Deserialize(Path.Combine(toPath, "config\\db.config"));
         newConfig.DBConnectionString = newConfig.DBConnectionString.Replace("{$App}", toPath);
         DBMigrator.DoMigrate(xmlPath, oldConfig, newConfig, tables);
         return("0");
     }
     catch (Exception ex)
     {
         string source = "We7.CMS.Install-InstallWebService—CopyTableDataFromCloneSite";
         EventLogHelper.WriteToLog(source, ex);
         throw We7Helper.RaiseException("CopyTableDataFromCloneSite", ex.Message, "", ex.Source, We7Helper.FaultCode.Server);
     }
 }
コード例 #19
0
        public void Close()
        {
            EventLogHelper.Write(string.Format("{0}服务被停止。", this.ServiceName));

            foreach (Process backgroundProcess in backgroundProcesses)
            {
                if (!backgroundProcess.HasExited)
                {
                    backgroundProcess.Close();
                }
            }

            backgroundProcesses.Clear();

            if (server != null)
            {
                server.Stop();
            }
        }
コード例 #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int          eventId = QueryHelper.GetInteger("eventid", 0);
        EventLogInfo ev      = EventLogProvider.GetEventLogInfo(eventId);

        // Set edited object
        EditedObject = ev;

        if (ev != null)
        {
            UTF8Encoding enc  = new UTF8Encoding();
            string       text = HTMLHelper.StripTags(HttpUtility.HtmlDecode(EventLogHelper.GetEventText(ev)));
            byte[]       file = enc.GetBytes(text);

            Response.AddHeader("Content-disposition", "attachment; filename=eventdetails.txt");
            Response.ContentType = "text/plain";
            Response.BinaryWrite(file);

            RequestHelper.EndResponse();
        }
    }
コード例 #21
0
        /// <summary>
        /// Startet den Ablauf
        /// </summary>
        /// <param name="args">Data passed by the start command.</param>
        protected override void OnStart(string[] args)
        {
            // Debugger.Launch();

            //if (string.IsNullOrEmpty(this.ServiceName))
            //{
            //    this.ServiceName = GetServiceName();
            //}

            try
            {
                this.dataBridge = new DataBridge();
                this.dataBridge.Load(this.dataBridge.GetConfigFileName());
                this.dataBridge.Start();
            }
            catch (Exception ex)
            {
                EventLogHelper.WriteEntry(Program.EventLogName, "Failed to start: " + ex.Message);
                throw;
            }
        }
コード例 #22
0
        public string DownLoad(string siteLoginName, string sitePassword, string pltype, string pluginName, string cmd, string action, string pluginPath)
        {
            string source = "";

            try
            {
                if (CheckAdmin(siteLoginName, sitePassword))
                {
                    //PluginHelper
                    return(new PluginHelper(GetPluginType(pltype)).RunCommand(pluginName, cmd, action, pluginPath));
                }
                else
                {
                    return(new PluginJsonResult(false, "安装站点的用户名与密码错误!").ToString());;
                }
            }
            catch (Exception ex)
            {
                EventLogHelper.WriteToLog(source, ex, EventLogEntryType.Error);
                throw ex;
            }
        }
コード例 #23
0
        /// <summary>
        /// 重启应用程序
        /// </summary>
        public static void LoadHelperFactory()
        {
            lock (lockHelper2)
            {
                //如果数据库配置文件存在,加载配置
                if (BaseConfigs.ConfigFileExist())
                {
                    BaseConfigInfo baseconfig = BaseConfigs.GetBaseConfig();

                    //加载数据库映射表
                    string          root     = AppDomain.CurrentDomain.BaseDirectory;
                    string          dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/XML");
                    ObjectAssistant assistat = new ObjectAssistant();
                    try
                    {
                        if (baseconfig != null && baseconfig.DBConnectionString != "")
                        {
                            baseconfig.DBConnectionString = baseconfig.DBConnectionString.Replace("{$App}", AppDomain.CurrentDomain.BaseDirectory);
                            assistat.LoadDBConnectionString(baseconfig.DBConnectionString, baseconfig.DBDriver);
                        }
                        assistat.LoadDataSource(dataPath);
                    }
                    catch (Thinkment.Data.DataException ex)
                    {
                        Debug.WriteLine(ex.ToString());
                        string source = "CD.Utils_CDHelper_ResetApplication";
                        EventLogHelper.WriteToLog(source, ex, EventLogEntryType.Error);
                        throw ex;
                    }

                    HelperFactory hf = new HelperFactory();

                    hf.Assistant = assistat;
                    hf.Root      = root;
                    hf.Initialize();
                    AppCtx.Cache.AddObject(HelperFactory.CacheKey, hf);
                }
            }
        }
コード例 #24
0
        public static string GetConfig(string key)
        {
            string cacheKey = "AppSettings-" + key;
            object cache    = CacheHelper.GetCache(cacheKey);

            if (cache == null)
            {
                try
                {
                    cache = ConfigurationManager.AppSettings[key];
                    if (cache != null)
                    {
                        CacheHelper.SetCache(cacheKey, cache, DateTime.Now.AddMinutes(180.0), TimeSpan.Zero);
                    }
                }
                catch (Exception ex)
                {
                    EventLogHelper.WriteEventLog(ex.ToString());
                }
            }
            return(cache.ToString());
        }
コード例 #25
0
 private static void Save(ExceptionData exData)
 {
     try
     {
         foreach (IExceptionLogger exceptionLogger in ConfigurationController.ExceptionLoggers)
         {
             try
             {
                 using (new TransactionScope(TransactionScopeOption.Suppress))
                     exceptionLogger.LogException(exData);
             }
             catch (Exception ex)
             {
                 EventLogHelper.Write(ExceptionManager.GetExceptionMessageWithDebugInfo((Exception) new OMFException(string.Format("{0} exception", (object)exceptionLogger.GetType().FullName), ex)), EventLogEntryType.Error);
             }
         }
     }
     catch (Exception ex)
     {
         throw new LogManagementException("[ExceptionServiceLoggerName] failed and throw an exception", ex);
     }
 }
コード例 #26
0
        public DataBridgeService(string[] args)
        {
            try
            {
                // Debugger.Launch();

                if (args.Length > 0)
                {
                    this.ServiceName = args[0];
                }

                this.InitializeComponent();

                Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            }
            catch (Exception ex)
            {
                EventLogHelper.WriteEntry(Program.EventLogName, "Failed to start: " + ex.Message);

                throw new Exception("Error in Constructor, Service could not be started.\n", ex);
            }
        }
コード例 #27
0
        public IActionResult Error()
        {
            var exceptionDetails = HttpContext.Features.Get <IExceptionHandlerPathFeature>();

            string path       = exceptionDetails.Path.Substring(1, exceptionDetails.Path.Length - 1);
            string controller = path.Substring(0, path.IndexOf("/"));
            int    length     = path.Length;
            int    remlen     = path.Length - controller.Length;
            string newstring  = path.Substring(controller.Length + 1, remlen - 1);
            string action     = "";

            if (newstring.Contains("/"))
            {
                action = newstring.Substring(0, newstring.IndexOf("/"));
            }
            else if (newstring.Contains("?"))
            {
                action = newstring.Substring(0, newstring.IndexOf("?") + 1);
            }
            else
            {
                action = newstring;
            }
            EventLogHelper.Error(_eventLogger, new Infrastructure.Models.EventLog
            {
                EventGuid   = Guid.NewGuid(),
                Action      = action,
                Application = "ESS",
                EventDate   = DateTime.UtcNow,
                Message     = exceptionDetails.Error.Message,
                Resource    = controller,
                StackTrace  = exceptionDetails.Error.StackTrace,
                UserGuid    = UserHelper.CurrentUserGuid(HttpContext)
            });
            return(View(new ErrorViewModel {
                RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
            }));
        }
コード例 #28
0
        static PageNameFilter()
        {
            _logger = new EventLogHelper(typeof(PageNameFilter));

            var filters = new List <IFilterPagesToAnalyze> {
            };

            var config = FiltersSection.Get();

            foreach (var filter in config.Filters.Cast <FilterElement>())
            {
                var filterType = Type.GetType(filter.NameOrType);
                if (filterType == null)
                {
                    _logger.Warn(() => string.Format("Couldn't load type for filter: {0}", filter.NameOrType));
                    continue;
                }

                filters.Add((IFilterPagesToAnalyze)Activator.CreateInstance(filterType));
            }

            _filters = filters.ToArray();
        }
コード例 #29
0
        public void Start()
        {
            EventLogHelper.Write(string.Format("{0}服务正在启动。", this.Name));

            server = new HttpServer(port, virtualPath, physicalPath,
                                    ConfigurationManager.AppSettings["staticFileFilters"],
                                    ConfigurationManager.AppSettings["directoryBrowse"]
                                    );

            string processes = ConfigurationManager.AppSettings["processes"];

            if (!string.IsNullOrEmpty(processes))
            {
                string[] fileNames = processes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string fileName in fileNames)
                {
                    Console.WriteLine("正在启动后台程序:" + fileName);

                    Process backgroundProcess = Process.Start(new ProcessStartInfo()
                    {
                        FileName = fileName, WindowStyle = ProcessWindowStyle.Hidden
                    });

                    backgroundProcesses.Add(backgroundProcess);
                }
            }

            server.Start();

            // 输出配置信息
            KernelContext.Log.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
            Console.WriteLine("Http server  starting success.");
            Console.WriteLine("Url \t\t: http://localhost:{0}{1}", port, virtualPath);
            Console.WriteLine("Physical path \t: {0}", physicalPath);
        }
コード例 #30
0
 private static async Task SaveAsync(ExceptionData exData)
 {
     try
     {
         foreach (IExceptionLogger exceptionLogger in ConfigurationController.ExceptionLoggers)
         {
             IExceptionLogger exLogger = exceptionLogger;
             try
             {
                 using (new TransactionScope(TransactionScopeOption.Suppress))
                 {
                     if (exLogger is IExceptionLoggerAsync)
                     {
                         await((IExceptionLoggerAsync)exLogger).LogExceptionAsync(exData);
                     }
                     else
                     {
                         exLogger.LogException(exData);
                     }
                 }
             }
             catch (Exception ex)
             {
                 OMFException dwdEx   = new OMFException(string.Format("{0} exception: {1}", (object)exLogger.GetType().FullName, (object)ex.Message), exData.Exception);
                 string       message = ExceptionManager.GetExceptionMessageWithDebugInfo((Exception)dwdEx);
                 EventLogHelper.Write(message, EventLogEntryType.Error);
                 continue;
             }
             exLogger = (IExceptionLogger)null;
         }
     }
     catch (Exception ex)
     {
         throw new LogManagementException("[ExceptionServiceLoggerName] failed and throw an exception", ex);
     }
 }