static void Main(string[] args) { serviceDefinition = ServiceInfoFactory.CreateServiceDefinition(new ServiceInfo { Port = Convert.ToInt32(ServiceConfig.Reader.Port) }); var store = new RegistryDatabaseFactory(); store.Create(); store.ApplySchema(); store.r.Connection.Dispose(); if (args.Length == 0 || args.Contains("-ampq")) { serviceRegistryServer = new RpcServer<ServiceInfo>(ConnectionConfig.GetFactoryDefault(), RegistrySettings.RegistryQueue, RegisterService); serviceRegistryServer.StartInBackground(); statsConsumer = StartStatsConsumer(); Console.WriteLine("Registry AMPQ started"); } if (args.Length == 0 || args.Contains("-web")) { webServer = WebApp.Start<Startup>(url: ServiceConfig.Reader.GetBaseAddress()); Console.WriteLine("Web server started"); } Console.ReadLine(); if (statsConsumer != null) { statsConsumer.StopConsumer(); serviceRegistryServer.Stop(); } if (webServer != null) { webServer.Dispose(); } }