Beispiel #1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     ConsulDI.AddConsulDiscovery(option =>
     {
         option.ConsulServerConfigPath = "ConsulServer.json";
         option.GrpcServiceConfigPath  = "GrpcServices.json";
     }
                                 , i => {
         i.Add(new TimingRecordInterceptor());
     });
 }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IServiceProvider serviceProvider, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            ConsulDI.UseConsulDiscovery(serviceProvider, (msg, ex) =>
            {
                Console.WriteLine(msg);
            });

            app.UseHttpsRedirection();
            app.UseMvc();
        }