Ejemplo n.º 1
0
 protected override void OnStart(string[] args)
 {
     DiscardCurrentWebApp();
     EventLog.WriteEntry(Configurations.DumpConfigurations(), EventLogEntryType.Information);
     if (!WarmedUp)
     {
         // 开始预热。
         WarmedUp   = true;
         warmUpTask = Analyzer.WarmUpAsync(AnalyzerFactory.CreateSearchClient());
         warmUpTask = warmUpTask.ContinueWith(t => warmUpTask = null);
     }
     currentWebApp = Program.StartWebApp();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 控制台的主入口。
        /// </summary>
        /// <param name="args"></param>
        static void ConsoleMain()
        {
            Console.WriteLine(Configurations.DumpConfigurations());
            Console.WriteLine(Utility.ProductName);
            Console.WriteLine(Utility.ApplicationTitle + " " + Utility.ProductVersion);
            // 开始预热。
            var warmUpTask = Analyzer.WarmUpAsync(AnalyzerFactory.CreateSearchClient());

            warmUpTask = warmUpTask.ContinueWith(t => warmUpTask = null);
            // Start OWIN host
            using (StartWebApp())
            {
WAITFORKEY:
                Console.WriteLine("请按任意键以结束服务。");
                Console.ReadKey(true);
                Console.WriteLine("请键入 EXIT 并回车以结束服务。");
                if (Console.ReadLine() != "EXIT")
                {
                    goto WAITFORKEY;
                }
            }
        }