有谁知道如何使用 s3 net API 添加自定义端点?
详情:<a href="https://github.com/aws/aws-sdk-net/issues/1283" rel="nofollow noreferrer">https://github.com/aws/aws-sdk-net/问题/1283 代码语言:C#
sServiceUrl 值="192.168.199.216:7480"
当我调用 DoesS3BucketExist 函数时,我修改了一个异常(System.UriFormatException)</p>
这是我的代码
public IAmazonS3 CreateClient(string sAccessKeyId, string sAccessKeySecret, string sServiceUrl)
{
AmazonS3Client s3Client = null;
try
{
AmazonS3Config config = new AmazonS3Config();
config.ServiceURL = sServiceUrl;
config.UseHttp = false;
config.SignatureVersion = "v4";
AWSConfigsS3.UseSignatureVersion4 = true;
s3Client = new AmazonS3Client(
sAccessKeyId,
sAccessKeySecret,
config
);
}
catch (Exception ex)
{
LogHelper.WriteLog("AWS配置", ex, "创建AmazonS3Client失败!");
}
return s3Client;
}
public bool DoesBucketExist(string bucketName)
{
bool bIsExist;
if (this.Client != null)
{
bIsExist = this.Client.DoesS3BucketExist(bucketName);
}
else
{
bIsExist = false;
}
return bIsExist;
}
我想设置这个属性AWSConfigs.EndpointDefinition = @"c:pathtoendpoints.xml";
,但我不知道如何自定义 endpoints.json 文件。
这对我来说太难了,也许我需要上帝帮助我!任何帮助将不胜感激!