Beispiel #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)
        {
            var log = ConfigureLogger();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //            app.UseOwin(x => x.UseNancy());

            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));
                 */
                buildFunc(next => CorrelationToken.Middleware(next));
                buildFunc(next => RequestLogging.Middleware(next, log));
                buildFunc.UseNancy();
            });
        }
Beispiel #2
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));
            });
        }
Beispiel #3
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));
            });
        }
Beispiel #4
0
        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());
            });
        }
Beispiel #5
0
        public void Log_each_incoming_request_and_each_outgoing_response()
        {
            using (TestCorrelator.CreateContext())
            {
                AppFunc pipelineFunc(AppFunc next) => RequestLogging.Middleware(next, m_Logger);

                var ctx = SetupOwinTestEnvironment("/test");

                var pipeline = pipelineFunc(m_NoOp);
                var env      = ctx.Environment;
                pipeline(env);

                var msgs = TestCorrelator.GetLogEventsFromCurrentContext();
                msgs.Should().NotBeEmpty().And.HaveCount(2);

                var reqLogMsg = msgs.First();
                reqLogMsg.Level.Should().Be(LogEventLevel.Information);
                reqLogMsg.RenderMessage().Should().Be("Incoming request: \"GET\", PathString { Value: \"/test\", HasValue: True }, []");

                var resLogMsg = msgs.Last();
                resLogMsg.Level.Should().Be(LogEventLevel.Information);
                resLogMsg.RenderMessage().Should().Be("Outgoing response: 200, []");
            }
        }
        // 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));
            });
        }