Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
ASP.NET Core HTTP logging middleware has been updated with extra functionality. The middleware now requires services registered with AddHttpLogging.
Version introduced
ASP.NET Core 8.0
Previous behavior
Previously, you could call just app.UseHttpLogging(); to activate HTTP logging.
New behavior
Starting in .NET 8, if you don't also call AddHttpLogging, an error is raised:
System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.ObjectPool.ObjectPool`1[Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext]' while attempting to activate 'Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware'.
Type of breaking change
This change is a behavioral change.
Reason for change
Additional features were added to the HttpLogging middleware that are registered (and configurable) via the AddHttpLogging method.
Recommended action
Call services.AddHttpLogging() during host construction.
Affected APIs
None.