docs/en/framework/infrastructure/blob-storing/aliyun.md
//[doc-seo]
{
"Description": "Learn how to configure Aliyun Blob storage with the ABP Framework for efficient BLOB storage in your applications."
}
BLOB Storing Aliyun Provider can store BLOBs in Aliyun Blob storage.
Read the BLOB Storing document to understand how to use the BLOB storing system. This document only covers how to configure containers to use a Aliyun BLOB as the storage provider.
Use the ABP CLI to add Volo.Abp.BlobStoring.Aliyun NuGet package to your project:
.csproj file you want to add the Volo.Abp.BlobStoring.Aliyun package.abp add-package Volo.Abp.BlobStoring.Aliyun command.If you want to do it manually, install the Volo.Abp.BlobStoring.Aliyun NuGet package to your project and add [DependsOn(typeof(AbpBlobStoringAliyunModule))] to the ABP module class inside your project.
Configuration is done in the ConfigureServices method of your module class, as explained in the BLOB Storing document.
Example: Configure to use the Aliyun storage provider by default
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.ConfigureDefault(container =>
{
container.UseAliyun(aliyun =>
{
aliyun.AccessKeyId = "your aliyun access key id";
aliyun.AccessKeySecret = "your aliyun access key secret";
aliyun.Endpoint = "your oss endpoint";
aliyun.RegionId = "your sts region id";
aliyun.RoleArn = "the arn of ram role";
aliyun.RoleSessionName = "the name of the certificate";
aliyun.Policy = "policy";
aliyun.DurationSeconds = "expiration date";
aliyun.ContainerName = "your aliyun container name";
aliyun.CreateContainerIfNotExists = true;
});
});
});
See the BLOB Storing document to learn how to configure this provider for a specific container.
false.BlobContainerName attribute (see the BLOB storing document). Please note that Aliyun has some rules for naming containers. A container name must be a valid DNS name, conforming to the following naming rules:
false, If a container does not exist in Aliyun, AliyunBlobProvider will try to create it.Aliyun Blob Provider organizes BLOB name and implements some conventions. The full name of a BLOB is determined by the following rules by default:
host string if current tenant is null (or multi-tenancy is disabled for the container - see the BLOB Storing document to learn how to disable multi-tenancy for a container).tenants/<tenant-id> string if current tenant is not null.AliyunBlobProvider is the main service that implements the Aliyun BLOB storage provider, if you want to override/replace it via dependency injection (don't replace IBlobProvider interface, but replace AliyunBlobProvider class).IAliyunBlobNameCalculator is used to calculate the full BLOB name (that is explained above). It is implemented by the DefaultAliyunBlobNameCalculator by default.IOssClientFactory is used create OSS client. It is implemented by the DefaultOssClientFactory by default. You can override/replace it,if you want customize.