65 lines
1.4 KiB
65 lines
1.4 KiB
11 months ago
|
//#define DEPLOY
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.ServiceProcess;
|
||
|
using System.Text;
|
||
|
using System.Reflection;
|
||
|
using Quartz;
|
||
|
using Quartz.Impl;
|
||
|
|
||
|
|
||
|
|
||
|
namespace SiaSun.LMS.WinService
|
||
|
{
|
||
|
static class Program
|
||
|
{
|
||
|
public static string _BaseUrl = SiaSun.LMS.Common.StringUtil.GetConfig("SiaSunSrvUrl");
|
||
|
|
||
|
public static log4net.ILog sysLog = log4net.LogManager.GetLogger("WinServiceLog");
|
||
|
|
||
|
static ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
|
||
|
static IScheduler scheduler;
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 应用程序的主入口点。
|
||
|
/// </summary>
|
||
|
static void Main()
|
||
|
{
|
||
|
#if DEPLOY
|
||
|
ServiceBase[] ServicesToRun;
|
||
|
|
||
|
ServicesToRun = new ServiceBase[]
|
||
|
{
|
||
|
new WMSService()
|
||
|
};
|
||
|
ServiceBase.Run(ServicesToRun);
|
||
|
#else
|
||
|
|
||
|
try
|
||
|
{
|
||
|
ServiceHostGroup.StartAllConfiguredServices();
|
||
|
|
||
|
scheduler = schedulerFactory.GetScheduler();
|
||
|
|
||
|
scheduler.Start();
|
||
|
|
||
|
while (true)
|
||
|
{
|
||
|
string sResult = string.Empty;
|
||
|
|
||
|
System.Threading.Thread.Sleep(2000);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
sysLog.Fatal("系统异常", ex);
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
}
|