Beispiel #1
0
        // Entry point for the application.
        public static void Main(string[] args)
        {
            IConfiguration config = ServiceBootstrapper.BuildConfiguration(args, ServiceBootstrapper.BuildConfigurationOptions.RandomizeUrls);
            IApplication   app    = ServiceBootstrapper.StartApplication(config);
            ILogger        logger = app.Services.GetService <ILogger <Startup> >();

            logger.LogInformation("Started the server...");
            logger.LogInformation($"Now listening on: {config["server.urls"]}");
            logger.LogInformation("Application started.Press Ctrl + C to shut down.");


            var registrator = new ServiceRegistrator(config);

            registrator.RegisterOperationService("1.0").ContinueWith(task =>
            {
                if (task.Status == TaskStatus.RanToCompletion)
                {
                    logger.LogInformation($"Service operation 1.0 registered with url {registrator.Url}");
                }
                else
                {
                    logger.LogCritical($"Failed to register service operation 1.0 with url {registrator.Url}", task.Exception);
                }
            });

            using (WaitHandle handle = ServiceBootstrapper.DisposeOnInterupt(app))
            {
                handle.WaitOne();
            }
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            IConfiguration config = ServiceBootstrapper.BuildConfiguration(args);
            IApplication   app    = ServiceBootstrapper.StartApplication(config);
            ILogger        logger = app.Services.GetService <ILogger <Startup> >();

            TaskManager.Initialize(new MyRegistry(app.Services.GetService <ILoggerFactory>()));

            logger.LogInformation("Started the server...");
            logger.LogInformation($"Now listening on: {config["server.urls"]}");
            logger.LogInformation("Application started.Press Ctrl + C to shut down.");

            using (WaitHandle handle = ServiceBootstrapper.DisposeOnInterupt(app))
            {
                handle.WaitOne();
            }
        }