public void StartTest() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); if (!principal.IsInRole(WindowsBuiltInRole.Administrator)) { Assert.Fail("You must be running this test as an Administrator"); } LogbusServerConfiguration config = new LogbusServerConfiguration(); using (ILogBus service = new LogbusService(config)) { service.Start(); int httpPort = 8065; // TODO: Eseguire l'inizializzazione a un valore appropriato using (WebServiceActivator webService = new WebServiceActivator(service, httpPort)) { webService.Start(); Thread.Sleep(10000); webService.Stop(); } service.Stop(); } }
static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e) { Console.WriteLine("Logbus is shutting down"); try { WebServiceActivator.Stop(); _logbus.Dispose(); } catch { } }
static void Main(string[] args) { Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress); Console.WriteLine("Starting the Logbus-ng daemon. You MUST be running this program as Administrator"); try { _logbus = LogbusSingletonHelper.Instance; _logbus.Start(); WebServiceActivator.Start(_logbus, 8065); Console.WriteLine("Logbus is started"); Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Console.WriteLine("Something went wrong..."); Console.WriteLine(ex); Environment.Exit(1); } }