Пример #1
0
        public async void StartService()
        {
            try
            {
                //Inicia container IOC
                var container = HostConfigurator.ConfigWinService(cfg => cfg.WinServiceRegister());

                //Inicia Quartz.NET Schedulers
                var properties = new NameValueCollection {
                    { "quartz.threadPool.threadCount", "25" }
                };
                var schedulerFactory = new StdSchedulerFactory(properties);

                var scheduler = await schedulerFactory.GetScheduler();

                scheduler.JobFactory = new JobFactory(container);
                await scheduler.Start();

                ScheduleJobs(scheduler);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }