diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs index 8b1f6e9d49..9a19337c5f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs @@ -17,19 +17,15 @@ namespace Microsoft.AspNetCore.Builder /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseMvcWithDefaultRouteAndArea( this IApplicationBuilder app, - Action additionalConfigurationAction = null) + Action additionalConfigurationAction = null) { - return app.UseMvc(routes => + return app.UseEndpoints(endpoints => { - routes.MapRoute( - name: "defaultWithArea", - template: "{area}/{controller=Home}/{action=Index}/{id?}"); + endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}"); + endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapRazorPages(); - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); - - additionalConfigurationAction?.Invoke(routes); + additionalConfigurationAction?.Invoke(endpoints); }); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs index eb0fc1ef48..1a12f5d6f9 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs @@ -77,10 +77,12 @@ namespace Volo.Abp.AspNetCore.Mvc var app = context.GetApplicationBuilder(); app.UseCorrelationId(); + app.UseRouting(); app.UseMiddleware(); + app.UseAuthorization(); app.UseAuditing(); app.UseUnitOfWork(); - app.UseMvcWithDefaultRoute(); + app.UseMvcWithDefaultRouteAndArea(); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs index 3ea9103e9e..29c7f7bc42 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/AbpAspNetCoreMvcVersioningTestModule.cs @@ -66,7 +66,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); - app.UseMvcWithDefaultRoute(); + app.UseMvcWithDefaultRouteAndArea(); } } }