Пример #1
0
 private async Task RunWindowsService(string[] args)
 {
     if (Console.IsInputRedirected)
     {
         // create and start using Windows service APIs
         windowsService = new IPBanWindowsServiceRunner(this, args);
         await windowsService.Run();
     }
     else
     {
         await RunConsoleService(args);
     }
 }
Пример #2
0
 private async Task RunWindowsService(string[] args)
 {
     // if we have no console input and we are not in IIS, run as windows service
     if (Console.IsInputRedirected && !OSUtility.IsRunningInProcessIIS())
     {
         // create and start using Windows service APIs
         windowsService = new IPBanWindowsServiceRunner(this, args);
         await windowsService.Run();
     }
     else
     {
         await RunConsoleService(args);
     }
 }
Пример #3
0
 private async Task RunWindowsService(string[] args)
 {
     // if we have no console input and we are not in IIS and not running an installer, run as windows service
     if (Console.IsInputRedirected && !OSUtility.IsRunningInProcessIIS() &&
         !args.Any(a => a.StartsWith("-install", StringComparison.OrdinalIgnoreCase)))
     {
         // create and start using Windows service APIs
         windowsService = new IPBanWindowsServiceRunner(this, args);
         await windowsService.Run();
     }
     else
     {
         await RunConsoleService(args);
     }
 }