【问题标题】:AWS S3 aws-sdk-cpp GetObject "Unable to connect to endpoint"AWS S3 aws-sdk-cpp GetObject“无法连接到端点”
【发布时间】:2016-04-03 09:12:49
【问题描述】:

我正在尝试使用 aws-sdk-cpp 从 S3 获取对象,但出现“”错误。 我成功地直接从网络浏览器访问该文件。

这是我的代码:

static const char* ALLOCATION_TAG = "App_TransferFiles_TAG";

// Create a client
ClientConfiguration config;
config.scheme = Scheme::HTTP;
config.connectTimeoutMs = 30000;
config.requestTimeoutMs = 30000;

m_s3Client = Aws::MakeShared<S3Client>(ALLOCATION_TAG, config);

TransferClientConfiguration transferConfig;
transferConfig.m_uploadBufferCount = 20;

m_transferClient = Aws::MakeShared<TransferClient>(ALLOCATION_TAG, m_s3Client, transferConfig);

GetObjectRequest getObjectRequest;
getObjectRequest.SetBucket(""MyBucketName");
getObjectRequest.SetKey("My_CONTENT_FILE_KEY");
GetObjectOutcome getObjectOutcome = m_s3Client->GetObject(getObjectRequest);

"m_s3Client->GetObject(getObjectRequest);"长时间等待后返回错误!!! 错误:“无法连接到端点”

我错过了什么?

【问题讨论】:

    标签: c++ amazon-s3 aws-sdk


    【解决方案1】:

    客户端配置中缺少区域! 只需添加:

    config.region = REGION;
    

    【讨论】:

      【解决方案2】:

      我也遇到过这个问题。我解决了它:

      config.region = Aws::Region::EU_CENTRAL_1; 
      config.scheme = Aws::Http::Scheme::HTTPS;
      config.connectTimeoutMs = 30000;
      config.requestTimeoutMs = 600000;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-03
        • 1970-01-01
        相关资源
        最近更新 更多