diff --git a/docs/core/compatibility/8.0.md b/docs/core/compatibility/8.0.md index 6c56c864ba3aa..947b451f98097 100644 --- a/docs/core/compatibility/8.0.md +++ b/docs/core/compatibility/8.0.md @@ -18,6 +18,7 @@ If you're migrating an app to .NET 8, the breaking changes listed here might aff | [ConcurrencyLimiterMiddleware is obsolete](aspnet-core/8.0/concurrencylimitermiddleware-obsolete.md) | Source incompatible | | [Custom converters for serialization removed](aspnet-core/8.0/problemdetails-custom-converters.md) | Behavioral change | | [Forwarded Headers Middleware ignores X-Forwarded-* headers from unknown proxies](aspnet-core/8.0/forwarded-headers-unknown-proxies.md) | Behavioral change | +| [HTTP logging middleware requires AddHttpLogging()](aspnet-core/8.0/httpLogging-addhttplogging-requirement.md) | Behavioral change | | [ISystemClock is obsolete](aspnet-core/8.0/isystemclock-obsolete.md) | Source incompatible | | [Minimal APIs: IFormFile parameters require anti-forgery checks](aspnet-core/8.0/antiforgery-checks.md) | Behavioral change | | [Rate-limiting middleware requires AddRateLimiter](aspnet-core/8.0/addratelimiter-requirement.md) | Behavioral change | diff --git a/docs/core/compatibility/aspnet-core/8.0/httplogging-addhttplogging-requirement.md b/docs/core/compatibility/aspnet-core/8.0/httplogging-addhttplogging-requirement.md new file mode 100644 index 0000000000000..f268500161eb3 --- /dev/null +++ b/docs/core/compatibility/aspnet-core/8.0/httplogging-addhttplogging-requirement.md @@ -0,0 +1,38 @@ +--- +title: "Breaking change: HTTP logging middleware requires AddHttpLogging()" +description: Learn about the breaking change in ASP.NET Core 8.0 where HTTP logging middleware now requires AddHttpLogging() to be called. +ms.date: 09/29/2025 +--- +# HTTP logging middleware requires AddHttpLogging() + +ASP.NET Core HTTP logging middleware has been updated with extra functionality. The middleware now requires services registered with . + +## 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 , 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](../../categories.md#behavioral-change). + +## Reason for change + +Additional features were added to the HttpLogging middleware that are registered (and configurable) via the method. + +## Recommended action + +Call `services.AddHttpLogging()` during host construction. + +## Affected APIs + +None. diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 33939a4065721..57d0156b74cfb 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -336,6 +336,8 @@ items: href: aspnet-core/8.0/problemdetails-custom-converters.md - name: Forwarded Headers Middleware ignores X-Forwarded-* headers from unknown proxies href: aspnet-core/8.0/forwarded-headers-unknown-proxies.md + - name: HTTP logging middleware requires AddHttpLogging() + href: aspnet-core/8.0/httpLogging-addhttplogging-requirement.md - name: ISystemClock is obsolete href: aspnet-core/8.0/isystemclock-obsolete.md - name: "Minimal APIs: IFormFile parameters require anti-forgery checks"