示例#1
0
 public static async Task MainService(string[] args, Func <string[], Task> start, Action stop, bool requireAdministrator = true)
 {
     try
     {
         using (IPBanServiceRunner runner = new IPBanServiceRunner(args, start, stop))
         {
             await runner.RunAsync(requireAdministrator);
         }
     }
     catch (Exception ex)
     {
         IPBanExtensionMethods.FileWriteAllTextWithRetry(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "startup_fail.txt"), ex.ToString());
         IPBanLog.Fatal("Fatal error starting service", ex);
     }
 }