dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.35k stars 9.99k forks source link

TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Internal.BufferingHelper' from assembly 'Microsoft.AspNetCore.Http, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. #22382

Closed arno0826 closed 4 years ago

arno0826 commented 4 years ago

Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://localhost:65029/swagger/index.html
“iisexpress.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.2\Microsoft.AspNetCore.WebUtilities.dll”。 “iisexpress.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.2\Microsoft.AspNetCore.Http.Extensions.dll”。 引发的异常:“System.TypeLoadException”(位于 System.Private.CoreLib.dll 中) 引发的异常:“System.TypeLoadException”(位于 System.Private.CoreLib.dll 中) “iisexpress.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.2\System.Diagnostics.StackTrace.dll”。 “iisexpress.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.2\System.Reflection.Metadata.dll”。 “iisexpress.exe”(CoreCLR: clrhost): 已加载“C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.2\System.Collections.Immutable.dll”。 Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request.

System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Internal.BufferingHelper' from assembly 'Microsoft.AspNetCore.Http, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. at Infrastructure.Middleware.RequestResponseLoggingMiddleware.FormatRequest(HttpRequest request) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Infrastructure.Middleware.RequestResponseLoggingMiddleware.FormatRequest(HttpRequest request) at Infrastructure.Middleware.RequestResponseLoggingMiddleware.Invoke(HttpContext context) in D:\XXXXXXXXXX at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

I get this wrong error when I upgrade the project from asp.net core 2.2 to 3.1

davidfowl commented 4 years ago

This was an intentional braking change that was made. This method is internal and the new API is EnableBuffering https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httprequestrewindextensions.enablebuffering?view=aspnetcore-3.1

ghost commented 4 years ago

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.