/// <summary> /// Main. /// </summary> public static void Main() { // change from service account's dir to more logical one Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); var logRepository = log4net.LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); HostFactory.Run(x => { x.RunAsLocalSystem(); x.SetDescription(Configuration.ServiceDescription); x.SetDisplayName(Configuration.ServiceDisplayName); x.SetServiceName(Configuration.ServiceName); x.Service(factory => { QuartzServer server = QuartzServerFactory.CreateServer(); server.Initialize().GetAwaiter().GetResult(); return(server); }); }); }
private void button1_Click(object sender, EventArgs e) { server = QuartzServerFactory.CreateServer(); server.Initialize(); server.Start(); LoadLogText(); ChangeBtnStatus(); }
/// <summary> /// Main. /// </summary> public static void Main() { Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory); HostFactory.Run(x => { x.RunAsLocalSystem(); x.SetDescription(Configuration.ServiceDescription); x.SetDisplayName(Configuration.ServiceDisplayName); x.SetServiceName(Configuration.ServiceName); x.Service(factory => { QuartzServer server = QuartzServerFactory.CreateServer(); server.Initialize(); return(server); }); }); }
/// <summary> /// Main. /// </summary> public static void Main() { // change from service account's dir to more logical one Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); XmlConfigurator.Configure(); HostFactory.Run(x => { x.RunAsLocalSystem(); x.SetDescription(Configuration.ServiceDescription); x.SetDisplayName(Configuration.ServiceDisplayName); x.SetServiceName(Configuration.ServiceName); x.Service(factory => { QuartzServer server = QuartzServerFactory.CreateServer(); server.Initialize().GetAwaiter().GetResult(); return(server); }); }); }
/// <summary> /// Main. /// </summary> public static void Main() { var kernel = new Ninject.StandardKernel(); // 加载所有定义在dll中的注册模块 var files = "NBlock*.dll,*Models.dll,*Services.dll,"; kernel.Load((files).Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); // 注册服务 kernel.Bind <ILogService>().To <Log4NetService>().InSingletonScope(); // 设置依赖注入 ServiceLocator.SetLocatorProvider(() => new NinjectServiceLocator(kernel)); // 配置Log服务 ServiceLocator.Current.GetInstance <ILogService>().Configure(); // 启动服务 Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory); HostFactory.Run(x => { x.RunAsLocalSystem(); x.SetDescription(Configuration.ServiceDescription); x.SetDisplayName(Configuration.ServiceDisplayName); x.SetServiceName(Configuration.ServiceName); x.Service(factory => { QuartzServer server = QuartzServerFactory.CreateServer(); server.Initialize(); return(server); }); }); }