1.启用路由? app.UseRouting(); 2.增加路由? ? ? ? ? ? app.UseEndpoints(endpoints =>? ? ? ? ? ? {? ? ? ? ? ? ? ? //endpoints.MapControllers();? ? ? ? ? ? ? ? endpoints.MapControllerRoute("Home", "/Home/{id}.html", new? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? controller = "Home",? ? ? ? ? ? ? ? ? ? action = "View"? ? ? ? ? ? ? ? });? ? ? ? ? ? ? ? //endpoints.MapControllerRoute(name: "areaRoute", "{area:exists}/{controller=Home}/{action=Index}");? ? ? ? ? ? ? ? //endpoints.MapDefaultControllerRoute();? ? ? ? ? ? ? ? endpoints.MapControllerRoute(? ? ? ? ? ? ? ? ? ? name: "default",? ? ? ? ? ? ? ? ? ? pattern: "{controller=Home}/{action=Index}/{id?}");? ? ? ? ? ? }); ? |