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(); }
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(); }