Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            MicroserviceBuilder.Init();
            var serviceProvider = new ServiceCollection()
                                  .AddConsul()
                                  .AddMicroservie(micropartServiceCollection =>
            {
                micropartServiceCollection
                .AddCallTreeOfZipkin()
                .AddConfigurationCenterOfConsul()
                .AddServiceCenterOfConsul()
                .AddRabbitMqAsEventBus()
                .AddLogOfNLog();
            })
                                  .AddTransient <Startup>()
                                  .BuildServiceProvider();

            ;


            var microserviceBuilder = serviceProvider.GetService <IMicroserviceBuilder>()
                                      .UseConsul()
                                      .UseMicroservice(micropartBuilder =>
            {
                micropartBuilder
                //.UseRabbitMqAsEventBus()
                .UseServiceCenterOfConsul()
                .UseCallTraceOfZipkin()
                .UseLogOfNLog();
            });
            var appLifetime = serviceProvider.GetService <IAppLifetime>();

            appLifetime.StartApplication();

            serviceProvider.GetService <Startup>().Run();
            Console.WriteLine("Hello World!");
        }
Ejemplo n.º 2
0
 public static void Main(string[] args)
 {
     MicroserviceBuilder.Init();
     BuildWebHost(args).Run();
 }