Open Closed

Azure Blob Name Calculator question #6180


User avatar
0
paykoolbackend created

Hello,

https://docs.abp.io/en/abp/latest/Blob-Storing-Azure#options

I would like to know if it's possible to remove the "host" string and directly use the blob name as the path under the container. (My current tenant is null)

Now: test1(container name)/host/data/test.pdf Expect: test2(container name)/data/test.pdf

Thanks.

  • ABP Framework version: v7.1.1
  • UI Type: Flutter
  • Database System: EF Core (SQL Server) / MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular):
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can override the DefaultAzureBlobNameCalculator service.

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/DefaultAzureBlobNameCalculator.cs#L18

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    paykoolbackend created

    hi

    I wrote the following code to override the DefaultAzureBlobNameCalculator service, but it cannot enter the TestBlobNameCalculator/Calculate.

    And throw error "Could not found the requested BLOB 'test.pdf' in the container 'TestContainer'!".

    Did I miss something?

    public class TestBlobNameCalculator : DefaultAzureBlobNameCalculator
    {
        public TestBlobNameCalculator(ICurrentTenant currentTenant) : base(currentTenant)
        {
        }
    
        public override string Calculate(BlobProviderArgs args)
        {
            if (args.ContainerName == "testContainer")
            {c
                return args.BlobName;
            }
    
            return base.Calculate(args);
        }
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    And throw error "Could not found the requested BLOB 'test.pdf' in the container 'TestContainer'!".

    Please share the full error stack. Thanks.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    paykoolbackend created

    I found a solution.

    https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services#overriding-a-service-class

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Great!

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.