diff --git a/aspnetcore/migration/31-to-50.md b/aspnetcore/migration/31-to-50.md index 229342fd92..cb969648ce 100644 --- a/aspnetcore/migration/31-to-50.md +++ b/aspnetcore/migration/31-to-50.md @@ -694,6 +694,39 @@ Apps that rely on the presence of the `ComplexTypeModelBinderProvider` in the `M + var complexModelBinderProvider = options.ModelBinderProviders.OfType(); ``` +## UseDatabaseErrorPage obsolete + +The ASP.NET Core 3.1 templates that include an option for individual user accounts generate a call to . `UseDatabaseErrorPage` is now obsolete and should be replaced with a combination of `AddDatabaseDeveloperPageExceptionFilter` and `UseMigrationsEndPoint`, as shown in the following code: + +```diff +public void ConfigureServices(IServiceCollection services) +{ + services.AddDbContext(options => + options.UseSqlServer( + Configuration.GetConnectionString("DefaultConnection"))); ++ services.AddDatabaseDeveloperPageExceptionFilter(); + services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) + .AddEntityFrameworkStores(); + services.AddRazorPages(); +} + +public void Configure(IApplicationBuilder app, IWebHostEnvironment env) +{ + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); ++ app.UseMigrationsEndPoint() +- app.UseDatabaseErrorPage(); + } + else + { + app.UseExceptionHandler("/Error"); + app.UseHsts(); + } +``` + +For more information, see [this GitHub issue](https://github.com/dotnet/aspnetcore/issues/24987). + ## Review breaking changes For breaking changes from .NET Core 3.1 to .NET 5.0, see [Breaking changes for migration from version 3.1 to 5.0](/dotnet/core/compatibility/3.1-5.0). ASP.NET Core and Entity Framework Core are also included in the list.