// Name of container to be created
string containerName = "mycontainer2";
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
CloudBlobContainer container = blobClient.GetContainerReference(containerName);
// Create the container if it doesn't already exist.
container.CreateIfNotExists();
这是官方代码,创建时报错
远程服务器返回错误(403)
怎么回事?
Hi,
从你贴出的代码来看没什么问题,我建议你去检查storage连接字符串,还有在代码的最后面加上一个条件判断句: “container.CreateIfNotExists();“,关于blob的具体使用,请阅读这篇文章: http://www.windowsazure.cn/zh-cn/develop/net/how-to-guides/blob-storage-v17/。
Best Regards,
Jambor
http://www.windowsazure.cn/zh-cn/develop/net/how-to-guides/blob-storage-v17/
谢谢你的回复和提供的链接, CloudStorageAccount storageAccount = CloudStorageAccount.Parse的方式来解析出来的地址是不对的,应该
自己去创建credential,拼接地址,因为在中国使用blob服务的方式和国外的不一样。