예제 #1
0
 /// <summary>
 /// 服务关闭
 /// </summary>
 protected override void OnStop()
 {
     try
     {
         if (proxy.IsActive)
         {
             proxy.Stop();
             "PHP-CGI Stop =======================================-".Log();
         }
     }
     catch (Exception e)
     {
         e.Message.Log();
         e.StackTrace.Log();
     }
     LogExtends.Finally();
 }
예제 #2
0
 /// <summary>
 /// 应用程序的主入口点。
 /// </summary>
 static void Main()
 {
     ThreadPool.SetMaxThreads(10, 10); // 线程数量
     AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
     {
         "捕获了漏掉的异常".Log();
         e.ExceptionObject.ToString().Log();
     };
     AppDomain.CurrentDomain.ProcessExit += (sender, e) => {
         LogExtends.Finally();
     };
     ServiceBase[] ServicesToRun;
     ServicesToRun = new ServiceBase[]
     {
         new PhpCgiService()
     };
     ServiceBase.Run(ServicesToRun);
 }