// 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)
        {
            app.AddConsulData();

            /*
             #region 注册Consul
             * //注册Consul
             * string ip = Configuration["ip"];
             * string port = Configuration["port"];
             * string serviceName = "MsgService";
             * string serviceId = serviceName + Guid.NewGuid();
             * using (var consulClient = new ConsulClient(ConsulConfig))
             * {
             *  AgentServiceRegistration asr = new AgentServiceRegistration
             *  {
             *      Address = ip,
             *      Port = Convert.ToInt32(port),
             *      ID = serviceId,
             *      Name = serviceName,
             *      Check = new AgentServiceCheck
             *      {
             *          DeregisterCriticalServiceAfter = TimeSpan.FromSeconds(5),
             *          HTTP = $"http://{ip}:{port}/api/Health",
             *          Interval = TimeSpan.FromSeconds(10),
             *          Timeout = TimeSpan.FromSeconds(5),
             *      },
             *  };
             *  consulClient.Agent.ServiceRegister(asr).Wait();
             * }
             *
             * //注销Consul
             * lifetime.ApplicationStopped.Register(() =>
             * {
             *  using (var consulClient = new ConsulClient(ConsulConfig))
             *  {
             *      Console.WriteLine("应用退出,开始从consul注销");
             *      consulClient.Agent.ServiceDeregister(serviceId).Wait();
             *  }
             * });
             #endregion
             */
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }