Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime, IOptions <HealthService> healthService, IOptions <ConsulService> consulService, IRpcConfig rpc)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // 添加健康检查路由地址
            app.Map("/health", HealthMap);

            // 服务注册
            app.RegisterConsul(lifetime, healthService, consulService);

            // 启动Rpc服务
            rpc.Start();
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime, IOptions <HealthService> healthService, IOptions <ConsulService> consulService, IRpcConfig rpc)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            // 添加健康检查路由地址
            app.Map("/health", HealthMap);

            // 服务注册
            app.RegisterConsul(lifetime, healthService, consulService);
            // 启动Rpc服务
            rpc.Start();
            //app.UseRouting();

            //app.UseEndpoints(endpoints =>
            //{
            //    endpoints.MapGet("/", async context =>
            //    {
            //        await context.Response.WriteAsync("Hello World!");
            //    });
            //});
        }