Browse Source

Merge pull request #21790 from abpframework/auto-merge/rel-9-0/3345

Merge branch dev with rel-9.0
pull/21793/head
maliming 1 year ago
committed by GitHub
parent
commit
6d3507aa5f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs

16
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs

@ -177,6 +177,22 @@ public static class AbpApplicationBuilderExtensions
throw new AbpException("The app(IApplicationBuilder) is not an IEndpointRouteBuilder.");
}
var environment = endpoints.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
if (environment.IsDevelopment())
{
// MapStaticAssets in development mode will have a performance issue if there are many static files.
// https://github.com/dotnet/aspnetcore/issues/59673
app.UseStaticFiles();
// Volo.Abp.AspNetCore.staticwebassets.endpoints.json is an empty file. Just compatible with the return type of MapAbpStaticAssets.
var tempStaticAssetsManifestPath = Path.Combine(AppContext.BaseDirectory, "Volo.Abp.AspNetCore.staticwebassets.endpoints.json");
if (!File.Exists(tempStaticAssetsManifestPath))
{
File.WriteAllText(tempStaticAssetsManifestPath, "{\"Version\":1,\"ManifestType\":\"Build\",\"Endpoints\":[]}");
}
return endpoints.MapStaticAssets(tempStaticAssetsManifestPath);
}
var options = app.ApplicationServices.GetRequiredService<IOptions<AbpAspNetCoreContentOptions>>().Value;
foreach (var folder in options.AllowedExtraWebContentFolders)
{

Loading…
Cancel
Save