开发者社区> 问答> 正文

AccessDenied.The bucket you are attempting to…错误

已解决

展开
收起
2018-03-05 05:25:45 7531 0
2 条回答
写回答
取消 提交回答
  • 采纳回答

    详细解答可以参考官方帮助文档

    访问OSS遇到如下的错误:

    <Code>AccessDenied</Code>
    <Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>

    原因:您访问Bucket使用的Endpoint不正确,如果您需要了解Endpoint的详细信息,请参看OSS 基本概念

    怎么找到正确的Endpoint呢?如果SDK异常抛出如下的异常,或返回如下错误:

    <Error>
      <Code>AccessDenied</Code>
      <Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
      <RequestId>56EA****3EE6</RequestId>
      <HostId>my-oss-bucket-*****.aliyuncs.com</HostId>
      <Bucket>my-oss-bucket-***</Bucket>
      <Endpoint>oss-cn-****.aliyuncs.com</Endpoint>
    </Error>
    • 其中Endpoint中的oss-cn-****.aliyuncs.com就是正确的Endpoint,请使用http://oss-cn-****.aliyuncs.comhttps://oss-cn-****.aliyuncs.com作为Endpoint访问OSS。
    • 如果错误中没有Endpoint,请登录OSS控制台,在Bucket管理中找到您访问的Bucket,单击进入Bucket概览页面。OSS域名中可以看到内网和外网域名。
    • 外网域名是在公网上访问OSS使用的域名;内网域名是指在阿里云内部访问的OSS使用的域名。比如您在您的ECS上访问OSS,可以使用内网域名。
    • Endpoint是域名去掉Bucket部分,加上访问协议。例如上图中OSS的公网域名是oss-****.aliyuncs.com,它的公网Endpoint是http://oss-cn-****.aliyuncs.com;类似,内网Endpoint是http://oss-cn-****-internal.aliyuncs.com
    2018-03-08 16:47:09
    赞同 展开评论 打赏
  • 问题原因

    权限问题。

    本回答引用自以下KB文档:OSS权限相关常见错误的排查方法

    更多帮助请访问以下站点:

    2021-08-31 17:03:08
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载