I used .NET Upgrade Assistant to upgrade a .NET Core 2.2. web application to .NET 6.0. and I started having routing problems such as “No webpage was found for the web address: https://localhost:44344/Identity/Account/Login?ReturnUrl=%2F” and “InvalidOperationException: The view ‘Index’ was not found.” (after removing Identity authentication annotations from the controller).
-
I added “services.AddMvc(options => options.EnableEndpointRouting = false);” to the ConfigureServices method in Startup.cs but it didn’t work.
-
I also tried to replace app.UseMvc() by app.UseEndpoints() (check below) but the problem still persists.
app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}");
});
app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
});
Does anyone have any hint on how I can solve this?
Thanks.