Beispiel #1
0
 public static GlobalManament GetInstance()
 {
     if (instance == null)
     {
         lock (objLock)
         {
             if (instance == null)
             {
                 instance = new GlobalManament();
             }
         }
     }
     return(instance);
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Logger.Init(AppDomain.CurrentDomain.BaseDirectory + @"Configs\Log4Net.config"); //初始化日志工具
            System.Threading.Mutex mutex = new System.Threading.Mutex(false, "DataEngine.Service");
            bool Running = !mutex.WaitOne(0, false);

            GlobalManament.GetInstance().RunConfigJobs();
            if (!Running)
            {
                int port = GlobalManament.GetInstance().serviceConfig.ServicePort;
                var host = new WebHostBuilder()
                           .UseKestrel()
                           .UseUrls($"http://localhost:{port}")
                           .UseContentRoot(Directory.GetCurrentDirectory())
                           .UseIISIntegration()
                           .UseStartup <Startup>()
                           .Build();
                host.Run();
            }
        }