Browse Source

Don't fail startup when static web assets can not be loaded

pull/26157/head
maliming 19 hours ago
parent
commit
e8db98f1d9
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 10
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs

10
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using MyCSharp.HttpUserAgentParser.DependencyInjection; using MyCSharp.HttpUserAgentParser.DependencyInjection;
using Volo.Abp.AspNetCore.Auditing; using Volo.Abp.AspNetCore.Auditing;
using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.AspNetCore.VirtualFileSystem;
@ -64,7 +65,14 @@ public class AbpAspNetCoreModule : AbpModule
context.Services.AddObjectAccessor<IEndpointRouteBuilder>(); context.Services.AddObjectAccessor<IEndpointRouteBuilder>();
context.Services.AddAbpDynamicOptions<RequestLocalizationOptions, AbpRequestLocalizationOptionsManager>(); context.Services.AddAbpDynamicOptions<RequestLocalizationOptions, AbpRequestLocalizationOptionsManager>();
StaticWebAssetsLoader.UseStaticWebAssets(context.Services.GetHostingEnvironment(), context.Services.GetConfiguration()); try
{
StaticWebAssetsLoader.UseStaticWebAssets(context.Services.GetHostingEnvironment(), context.Services.GetConfiguration());
}
catch (Exception ex)
{
context.Services.GetInitLogger<AbpAspNetCoreModule>().LogWarning(ex, "Could not load the static web assets manifest, static web assets will not be available. This usually happens when the application runs with build output instead of publish output.");
}
context.Services.AddHttpUserAgentCachedParser(); context.Services.AddHttpUserAgentCachedParser();
} }

Loading…
Cancel
Save