包信息
| 属性 | 值 |
|---|---|
| NuGet 包 | Bitzsoft.Integrations.FileStorage.Aws |
| Provider ID | aws |
| 鉴权 | AWS AccessKeyId + SecretAccessKey(SIGv4) |
配置字段(AwsS3Options)
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
AccessKeyId | string | 是 | — | AWS Access Key ID |
SecretAccessKey | string | 是 | — | AWS Secret Access Key |
Region | string | 是 | — | AWS 区域(如 us-east-1) |
DefaultBucketName | string | 是 | — | 默认存储桶名称 |
ServiceURL | string | 否 | — | 自定义 S3 端点(兼容 MinIO 等) |
ForcePathStyle | bool | 否 | false | 是否强制路径风格寻址 |
HttpClientName | string | 否 | — | HttpClient 名称 |
UploadUrlExpiration | int | 否 | 3600 | 上传地址过期时间(秒) |
DownloadUrlExpiration | int | 否 | 43200 | 下载地址过期时间(秒) |
配置示例
{ "FileStorage": { "Aws": { "AccessKeyId": "AKIAIOSFODNN7EXAMPLE", "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "Region": "us-east-1", "DefaultBucketName": "my-bucket" } }}DI 注册
builder.Services.AddBitzsoftAwsS3FileStorage(builder.Configuration.GetSection("FileStorage:Aws"));使用示例
public class S3Service(IFileStore store){ public async Task MoveAsync(string source, string dest) { await store.MoveFileAsync(source, dest); }}已知限制
- 兼容 S3 协议的第三方存储(如 MinIO)可通过
ServiceURL+ForcePathStyle = true接入。 - 不配置
ServiceURL时使用 AWS 官方端点。