예제 #1
0
파일: Program.cs 프로젝트: Turntwo/nvents
 static void Main(string[] args)
 {
     if (!Debugger.IsAttached)
     {
         HostFactory.Run(x =>
         {
             x.Service<NventsSignalRWindowsService>(s =>
             {
                 s.ConstructUsing(hs => new NventsSignalRWindowsService());
                 s.WhenStarted(tm => tm.Start());
                 s.WhenStopped(tm => tm.Stop());
             });
             x.SetDescription("Nvents SignalR Service");
             x.SetDisplayName("Nvents SignalR Service");
             x.SetServiceName("NventsSignalRService");
             x.StartAutomaticallyDelayed();
             x.EnableServiceRecovery(rc =>
             {
                 rc.RestartService(1); // restart the service after 1 minute
                 rc.RestartService(1); // restart the service after 1 minute
                 rc.RestartService(1); // restart the service after 1 minute
                 rc.SetResetPeriod(1); // set the reset interval to one day
             });
         });
     }
     else
     {
         // Run service in debug mode
         var service = new NventsSignalRWindowsService();
         service.Start();
         Console.WriteLine("Press any key to continue");
         Console.ReadKey();
         service.Stop();
     }
 }
예제 #2
0
 public SignalRServiceTests()
 {
     var host = new NventsSignalRWindowsService();
     host.Start();
     Events.Service = new SignalRService();
 }