解决阿里云OSS The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint的办法

以前有一个上海节点的存储包,一直使用正常。最近购买了一个全国的存储包,发现在上传文件的时候有这个问题。

尝试了很多办法,还提交了工单,都没有解决。

最后解决办法如下:

1、在阿里云OSS管理控制台下,创建一个Bucket。

2、使用代码访问这个Bucket。

3、正常访问

前面没有在控制台创建Bucket,用代码创建一直不成功。后面在控制台创建了一个Bucket,然后用代码访问这个Bucket,并上传了一个文件。现在我再用代码创建其它的Bucket就成功了。

期间没有修改过任何代码。

网上说的EndPoint用三级域名,尝试过此办法,但还是不管用,你带了三级域名,它会报“The specified bucket is not valid.”这个错。

关于EndPoint这里,也要确认无误,我这里用的是

1 const string ShenZhenEndPoint = "http://oss-cn-shenzhen-internal.aliyuncs.com";

各地域的EndPoint可以通过以下链接查看

https://help.aliyun.com/document_detail/31837.html?spm=a2c4g.11186623.2.4.YOAwGz

posted @ 2018-08-07 11:52  zhaotianff  阅读(14670)  评论(0编辑  收藏  举报