Open Closed

Problem with File Management module and Azure blob storage #1122


User avatar
0
hansmogren created

Hi!

I installed the File Management Module installed using ABP CLI and configured it to use Azure Blob Storage as backing storage.

When I go to Administration / File Management I get an error message "An internal error occured during your request!":

Why is this? Is there some configuration I've forgot? I've tried with different Azure connection strings used without problems with other applications.

        private void ConfigureBlobStorage(ServiceConfigurationContext context)
        {
            var configuration = context.Services.GetConfiguration();
            var connectionString = configuration.GetValue<string>("BlobStorage:ConnectionString");
            var containerName = configuration.GetValue<string>("BlobStorage:ContainerName");

            Configure<AbpBlobStoringOptions>(options =>
            {
                options.Containers.Configure<FileManagementContainer>(blobContainer =>
                {
                    blobContainer.UseAzure(azure =>
                    {
                        azure.ConnectionString = connectionString;
                        azure.ContainerName = containerName;
                    });
                });
            });
        }
  • ABP Framework version: v4.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
[ERR] An exception was thrown while activating Volo.FileManagement.Web.Pages.FileManagement.Directory.CreateModalModel -> Volo.FileManagement.Directories.DirectoryDescriptorAppService -> Volo.FileManagement.Directories.DirectoryManager -> Volo.FileManagement.Files.FileManager -> Volo.Abp.BlobStoring.BlobContainer`1[[Volo.FileManagement.FileManagementContainer, Volo.FileManagement.Domain, Version=4.2.2.0, Culture=neutral, PublicKeyToken=null]].
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.FileManagement.Web.Pages.FileManagement.Directory.CreateModalModel -> Volo.FileManagement.Directories.DirectoryDescriptorAppService -> Volo.FileManagement.Directories.DirectoryManager -> Volo.FileManagement.Files.FileManager -> Volo.Abp.BlobStoring.BlobContainer`1[[Volo.FileManagement.FileManagementContainer, Volo.FileManagement.Domain, Version=4.2.2.0, Culture=neutral, PublicKeyToken=null]].
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Volo.Abp.BlobStoring.IBlobContainerFactory)' on type 'BlobContainer`1'.
 ---> Volo.Abp.AbpException: Could not find the BLOB Storage provider with the type (Volo.Abp.BlobStoring.Azure.AzureBlobProvider, Volo.Abp.BlobStoring.Azure, Version=4.2.2.0, Culture=neutral, PublicKeyToken=null) configured for the container file-management and no default provider was set.
   at Volo.Abp.BlobStoring.DefaultBlobProviderSelector.Get(String containerName)
   at Volo.Abp.BlobStoring.BlobContainerFactory.Create(String name)
   at lambda_method3170(Closure , Object[] )
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   --- End of inner exception stack trace ---
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Builder.RegistrationBuilder`3.&lt;&gt;c__DisplayClass41_0.&lt;PropertiesAutowired&gt;b__0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Volo.Abp.AspNetCore.Mvc.UI.RazorPages.ServiceBasedPageModelActivatorProvider.<>c__DisplayClass0_0.<CreateActivator>b__0(PageContext context)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelFactoryProvider.<>c__DisplayClass3_0.<CreateModelFactory>b__0(PageContext pageContext)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.CreateInstance()
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  • Steps to reproduce the issue:
    1. Install File Management Module
    2. Run application
    3. Browse to Administration / File Management

3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Did you add the module dependcy?

    [DependsOn(typeof(AbpBlobStoringAzureModule))]

  • User Avatar
    0
    hansmogren created

    Did you add the module dependcy?

    [DependsOn(typeof(AbpBlobStoringAzureModule))]

    Thank you, that was it!

    By the way, should both the DependsOn attribute and the code where I configure FileManagementContainer & AbpBlobStoringOptions to use Azure go in my ProjectName.Application or in the ProjectName.Web module?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes, Add module depend and configure it.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38