Amazon s3에 이미지를 업로드하려고합니다. 나는 다른 소스 코드를 시도했지만 헛된 것은 아닙니다. 나는 b / w IAmazonClient, Amazons3 객체 등을 구별하기 위해 붙어 있습니다. 누구나 나에게 예제를 제공하고 s3에 이미지를 업로드 할 수있는 방법을 지시 할 수 있습니까? 이미지를 캡처 할 수있는 REST 서비스를 개발 중입니다. 아마존 s3에 업로드합니다.
끝점 : 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를 제공해야한다는 것을 알고 있지만 Amazon.EndPoint 정의에 "ap-southeast-2"가 존재하지 않습니다.
마침내 나는 혼자서 해결책을 찾습니다.
AmazonS3Config asConfig = new AmazonS3Config()
{
ServiceURL = "http://irisdb.s3-ap-southeast2.amazonaws.com/",
RegionEndpoint = Amazon.RegionEndpoint.APSoutheast2
};
RegionalEndPoints를 수정합니다. 내 응용 프로그램은 매력처럼 실행됩니다. 모두에게 감사합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다