diff --git a/src/Benchmarks/DebugInfoPageMiddleware.cs b/src/Benchmarks/DebugInfoPageMiddleware.cs index 72d070cb9..91c7d991b 100644 --- a/src/Benchmarks/DebugInfoPageMiddleware.cs +++ b/src/Benchmarks/DebugInfoPageMiddleware.cs @@ -48,16 +48,17 @@ public async Task Invoke(HttpContext httpContext) await httpContext.Response.WriteAsync($"
  • Configuration: {_configurationName}
  • "); await httpContext.Response.WriteAsync($"
  • Server: {_hostingEnv.Configuration["server"]}
  • "); await httpContext.Response.WriteAsync($"
  • Server URLs: {_hostingEnv.Configuration["server.urls"]}
  • "); + await httpContext.Response.WriteAsync($"
  • Supports Send File: {httpContext.Response.SupportsSendFile()}
  • "); - await httpContext.Response.WriteAsync($"
  • Server features:
      "); + await httpContext.Response.WriteAsync($"
    1. Server features:
        "); + foreach (var feature in httpContext.Features) { await httpContext.Response.WriteAsync($"
      • {feature.Key.Name}
      • "); } - await httpContext.Response.WriteAsync($"
  • "); + await httpContext.Response.WriteAsync($""); await httpContext.Response.WriteAsync(""); - return; } diff --git a/src/Benchmarks/ErrorHandlerMiddleware.cs b/src/Benchmarks/ErrorHandlerMiddleware.cs index 5c7c31378..117def1ad 100644 --- a/src/Benchmarks/ErrorHandlerMiddleware.cs +++ b/src/Benchmarks/ErrorHandlerMiddleware.cs @@ -25,8 +25,13 @@ public async Task Invoke(HttpContext httpContext) } catch (Exception ex) { - httpContext.Response.StatusCode = StatusCodes.Status500InternalServerError; - httpContext.Response.ContentType = "text/html"; + if (!httpContext.Response.HasStarted) + { + httpContext.Response.Clear(); + httpContext.Response.StatusCode = StatusCodes.Status500InternalServerError; + httpContext.Response.ContentType = "text/html"; + } + await httpContext.Response.WriteAsync($"
    {ex.ToString()}
    "); } }