Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/core/compatibility/8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A>.

## 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 <xref:Microsoft.Extensions.DependencyInjection.HttpLoggingServicesExtensions.AddHttpLogging%2A>, 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 <xref:Microsoft.AspNetCore.Telemetry.HttpLoggingServiceExtensions.AddHttpLogging*> method.

## Recommended action

Call `services.AddHttpLogging()` during host construction.

## Affected APIs

None.
2 changes: 2 additions & 0 deletions docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading