Skip to content

DiagnosticListener not firing an event when kestrel rejects a request #34269

@MarkGreenbergClinch

Description

@MarkGreenbergClinch

Description

In the documentation the suggested way to listen to such events is subscribing to the DiagnosticListener and filtering this event "Microsoft.AspNetCore.Server.Kestrel.BadRequest", in a .net7 project this works but since .net8 this stopped working. Currently there is no way to listen to these events through the code, the diagnostic listener does not fire any event for these rejected requests. There is the metrics feature but it's another process that needs to run alongside the asp server and poll it.
I would love to know if there is another way because I could not find anything about this at all. No discussions no nothing.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/diagnostics?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/servers/kestrel/diagnostics.md

Document ID

6842867b-1533-7a03-902d-c573adc9a371

Article author

@shirhatti

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions