From 04165fd54390d56796a5374cd3d77c5e004f9902 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 1 Jan 2025 13:29:41 +0800 Subject: [PATCH] Use `StaticFiles` instead of `MapStaticAssets` in `Development`. --- .../Builder/AbpApplicationBuilderExtensions.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index 1bf3e45e4a..2dbd73a3ee 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -177,6 +177,15 @@ public static class AbpApplicationBuilderExtensions throw new AbpException("The app(IApplicationBuilder) is not an IEndpointRouteBuilder."); } + var environment = endpoints.ServiceProvider.GetRequiredService(); + if (environment.IsDevelopment()) + { + app.UseStaticFiles(); + // Volo.Abp.AspNetCore.staticwebassets.endpoints.json is a empty file. + // https://github.com/dotnet/aspnetcore/issues/59673 + return endpoints.MapStaticAssets("Volo.Abp.AspNetCore.staticwebassets.endpoints.json"); + } + var options = app.ApplicationServices.GetRequiredService>().Value; foreach (var folder in options.AllowedExtraWebContentFolders) {