Example #1
0
        public void Configure(IApplicationBuilder app)
        {
            var listener         = new RazorPageDiagnosticListener();
            var diagnosticSource = app.ApplicationServices.GetRequiredService <DiagnosticListener>();

            diagnosticSource.SubscribeWithAdapter(listener);

            app.Use(async(context, next) =>
            {
                using (var writer = new StreamWriter(context.Response.Body))
                {
                    context.Items[RazorPageDiagnosticListener.WriterKey] = writer;
                    context.Response.Body = Stream.Null;
                    await next();
                }
            });

            // Add MVC to the request pipeline
            app.UseMvcWithDefaultRoute();
        }
Example #2
0
        public void Configure(IApplicationBuilder app)
        {
            var listener = new RazorPageDiagnosticListener();
            var diagnosticSource = app.ApplicationServices.GetRequiredService<DiagnosticListener>();
            diagnosticSource.SubscribeWithAdapter(listener);

            app.UseCultureReplacer();

            app.Use(async (context, next) =>
            {
                using (var writer = new StreamWriter(context.Response.Body))
                {
                    context.Items[RazorPageDiagnosticListener.WriterKey] = writer;
                    context.Response.Body = Stream.Null;
                    await next();
                }
            });

            // Add MVC to the request pipeline
            app.UseMvcWithDefaultRoute();
        }