コード例 #1
0
        public void Configure(IApplicationBuilder app)
        {
            var log = ConfigureLogger();

            app.UseOwin(buildFunc =>
            {
                buildFunc(next => GlobalErrorLogging.Middleware(next, log));
                buildFunc(next => CorrelationToken.Middleware(next));
                buildFunc(next => RequestLogging.Middleware(next, log));
                buildFunc(next => PerformanceLogging.Middleware(next, log));
                buildFunc(next => new MonitoringMiddleware(next, HealthCheck).Invoke);
                buildFunc.UseNancy(opt => opt.Bootstrapper = new Bootstrapper(log));
            });
        }
コード例 #2
0
        public void Configure(IApplicationBuilder app)
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 1024;
            ConfigurationBinder.Bind(Configuration.GetSection("ImageServer"), Conf);

            app.UseOwin(buildFunc =>
            {
                buildFunc(next => RequestId.Middleware(next));
                buildFunc(next => SizeConstraints.Middleware(next));
                buildFunc(next => RequestLogging.Middleware(next, Log));
                buildFunc(next => PerformanceLogging.Middleware(next, Log));
                buildFunc(next => new MonitoringMiddleware(next, HealthCheckAsync).InvokeAsync);
                buildFunc.UseNancy(opt => opt.Bootstrapper = new Bootstrapper(Conf, Log, httpClient));
            });
        }
コード例 #3
0
ファイル: Startup.cs プロジェクト: bronx2la/ACM_Studio.V2
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseCors("Cors");

            Logger log = ConfigurationLogger();

            app.UseOwin(buildFunc =>
            {
                buildFunc(next => GlobalErrorLogging.Middleware(next, log));
                buildFunc(next => CorrelationToken.Middleware(next));
                buildFunc(next => RequestLogging.Middleware(next, log));
                buildFunc(next => PerformanceLogging.Middleware(next, log));
                buildFunc(next => new MonitoringMiddleware(next, HealthCheck).Invoke);
                buildFunc.UseNancy(opt => opt.Bootstrapper = new CustomBootstrapper());
            });
        }
コード例 #4
0
        public async void Log_execution_time_of_the_request()
        {
            using (TestCorrelator.CreateContext())
            {
                AppFunc pipelineFunc(AppFunc next) => PerformanceLogging.Middleware(next, m_Logger);

                var ctx = SetupOwinTestEnvironment(TestPath);


                var pipeline = pipelineFunc(m_TestModule(m_NoOp, m_Logger));
                var env      = ctx.Environment;
                await pipeline(env).ConfigureAwait(false);

                var msg = TestCorrelator.GetLogEventsFromCurrentContext()
                          .Should().HaveCount(2)
                          .And.Contain(m => m.MessageTemplate.Text == "Request: {@Method} {@Path} executed in {RequestTime:000} ms");

                msg.Which.Level.Should().Be(LogEventLevel.Information);
                msg.Which.Properties.Should().Contain(p => p.Key == "RequestTime" && int.Parse(p.Value.ToString()) > 2000);
            }
        }
コード例 #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment envi)
        {
            var log = ILoggerFactory.ConfigureLogger();

            app.UseOwin(buildFunc => // let's you use OWIN with ASP.NET Core
            {
                buildFunc(next => CorrelationToken.Middleware(next));
                buildFunc(next => // buildFunc builds an OWIN pipeline from MidFunc
                          env =>
                {
                    var context = new OwinContext(env);
                    var method  = context.Request.Method;
                    var path    = context.Request.Path;
                    System.Console.WriteLine($"Got Request lambdas: {method} {path}");
                    return(next(env));
                });
                buildFunc(next => new ConsoleMiddleware(next).Invoke);
                buildFunc(next => RequestLogging.Middleware(next, log));
                buildFunc(next => PerformanceLogging.Middleware(next, log));
                buildFunc(next => new MonitoringMiddleware(next, ShoppingCart.Library.Stores.ShoppingCartStore.HealthCheck).Invoke);
                //buildFunc.UseNancy(); // this uses the default parameterless Nancy bootstrapper
                buildFunc.UseNancy(opt => opt.Bootstrapper = new Bootstrapper(log));
            });
        }