Browse Source

Use `StaticFiles` instead of `MapStaticAssets` in `Development`.

pull/21784/head
maliming 1 year ago
parent
commit
04165fd543
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 9
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs

9
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<IWebHostEnvironment>();
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<IOptions<AbpAspNetCoreContentOptions>>().Value;
foreach (var folder in options.AllowedExtraWebContentFolders)
{

Loading…
Cancel
Save