หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
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.