dotnet/aspnetcore

MigrationsEndPoint throwing `InvalidOperationException: Incorrect Content-Type:` on load

Open

#46.638 geöffnet am 9. Dez. 2022

Auf GitHub ansehen
 (13 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (10.653 Forks)batch import
area-networkingbughelp wanted

Repository-Metriken

Stars
 (37.933 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 16T 9h) (258 gemergte PRs in 30 T)

Beschreibung

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore package installed and I use app.UseMigrationsEndPoint() on my Program.cs. Whenever I enter migrations url (/ApplyDatabaseMigrations) I get this exception:

Seems like its missing Content-Type application/x-www-form-urlencoded in Headers.

Expected Behavior

It should load the migrations page correctly and include application/x-www-form-urlencoded Content-Type header.

Steps To Reproduce

Run the project and go to .../ApplyDatabaseMigrations page https://github.com/Hantick/EntityFrameworkCoreBug

Exceptions (if any)

System.InvalidOperationException: Incorrect Content-Type: 
   at Microsoft.AspNetCore.Http.Features.FormFeature.InnerReadFormAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.GetDbContext(HttpContext context, ILogger logger)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.InvokeCore(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

.NET Version

7.0.100

Anything else?

image

Contributor Guide