全部產品
Search
文件中心

Object Storage Service:通過SDK訪問OSS中的Bucket時報Endpoint錯誤

更新時間:Feb 28, 2024

問題描述

將資源上傳到阿里雲Object Storage Service後,通過SDK訪問OSS中的Bucket時,報如下錯誤。

The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint

問題原因

未指定Endpoint參數,或者指定的參數有誤。例如Bucket建立在青島地區,卻使用預設配置的oss-cn-hangzhou.aliyuncs.com杭州Endpoint地址去請求,就會出現該報錯。

解決方案

檢查OSS Bucket的Endpoint地址的正確性,具體操作如下:

  • 請確保使用正確的Endpoint地址訪問Bucket。例如Bucket所在地區為oss-cn-hangzhou,則外網Endpoint為oss-cn-hangzhou.aliyuncs.com。有關Endpoint的更多資訊,請參見OSS訪問網域名稱使用規則

  • 確認請求的Endpoint地址與Bucket實際的Endpoint地址一致。如果需要訪問青島和杭州兩個節點的Bucket,則建立多個Ossclient,定義Endpoint時,將青島和杭州地區的地址都添加進去。各地區及不同網路連接方式下的Endpoint資訊請參見Endpoint

更多資訊

適用於

  • Object Storage Service