diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs index 1d122549342..b59cbefa45c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs @@ -74,7 +74,14 @@ protected virtual Task CheckLibsAsync(HttpContext httpContext) var logger = httpContext.RequestServices.GetRequiredService>(); try { - var fileProvider = new PhysicalFileProvider(httpContext.RequestServices.GetRequiredService().WebRootPath); + var webHostEnvironment = httpContext.RequestServices.GetRequiredService(); + if (webHostEnvironment.WebRootPath.IsNullOrWhiteSpace()) + { + logger.LogWarning("The 'WebRootPath' is not set! The 'CheckLibs' feature is disabled!"); + return Task.FromResult(true); + } + + var fileProvider = new PhysicalFileProvider(webHostEnvironment.WebRootPath); var libsFolder = fileProvider.GetDirectoryContents("/libs"); if (!libsFolder.Exists || !libsFolder.Any()) {