在 Amazon S3 上上传图像。源代码
Upload images on Amazon S3. source code
我正在尝试在 Amazon s3 上上传图片。我尝试了不同的源代码,但没有 vain.I 无法区分 b/w IAmazonClient、Amazons3 对象等。
任何人都可以给我示例并指导我如何在 s3.I 上上传图像正在开发可以捕获图像并在 amazon s3 上上传的 REST 服务。
- 我的桶在澳大利亚悉尼。
- http://irisdb.s3apsoutheast2。
amazonaws.com/
- accesskey = "xxxxxxxx"
- 密钥="cxxxxxxxxx"
端点:irisdb.s3websiteapsoutheast2。
amazonaws.com
string accessKey = "xxxx";
string secretKey = "mxxxxx";
string bucketName = "irisdb"; // Set to a bucket you create
// Create S3 service client.
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3Config asConfig = new AmazonS3Config()
{
ServiceURL = "http://irisdb.s3-ap-southeast2.amazonaws.com/",
ServiceEndPoint = "irisdb.s3-website-ap-southeast2.amazonaws.com" //error here (cannot convert string to endpoints)
};
AmazonS3Client client2 = new AmazonS3Client(awsCredentials, asConfig);
ListBucketsResponse response = client2.ListBuckets();
我知道我需要在 serviceEndPoint 中提供 Amazon.Endpoints.ap-southeast-2 但 "ap-southeast-2" 在 Amazon.EndPoint 的定义中不存在
请帮助
最后我自己找到了解决办法
AmazonS3Config asConfig = new AmazonS3Config()
{
ServiceURL = "http://irisdb.s3-ap-southeast2.amazonaws.com/",
RegionEndpoint = Amazon.RegionEndpoint.APSoutheast2
};
使 RegionalEndPoints 正确。我的申请 运行 很吸引人。谢谢大家。
我正在尝试在 Amazon s3 上上传图片。我尝试了不同的源代码,但没有 vain.I 无法区分 b/w IAmazonClient、Amazons3 对象等。 任何人都可以给我示例并指导我如何在 s3.I 上上传图像正在开发可以捕获图像并在 amazon s3 上上传的 REST 服务。
- 我的桶在澳大利亚悉尼。
- http://irisdb.s3apsoutheast2。 amazonaws.com/
- accesskey = "xxxxxxxx"
- 密钥="cxxxxxxxxx"
端点:irisdb.s3websiteapsoutheast2。 amazonaws.com
string accessKey = "xxxx"; string secretKey = "mxxxxx"; string bucketName = "irisdb"; // Set to a bucket you create // Create S3 service client. BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey); AmazonS3Config asConfig = new AmazonS3Config() { ServiceURL = "http://irisdb.s3-ap-southeast2.amazonaws.com/", ServiceEndPoint = "irisdb.s3-website-ap-southeast2.amazonaws.com" //error here (cannot convert string to endpoints) }; AmazonS3Client client2 = new AmazonS3Client(awsCredentials, asConfig); ListBucketsResponse response = client2.ListBuckets();
我知道我需要在 serviceEndPoint 中提供 Amazon.Endpoints.ap-southeast-2 但 "ap-southeast-2" 在 Amazon.EndPoint 的定义中不存在 请帮助
最后我自己找到了解决办法
AmazonS3Config asConfig = new AmazonS3Config()
{
ServiceURL = "http://irisdb.s3-ap-southeast2.amazonaws.com/",
RegionEndpoint = Amazon.RegionEndpoint.APSoutheast2
};
使 RegionalEndPoints 正确。我的申请 运行 很吸引人。谢谢大家。