feng1456 2015-02-01 01:58 采纳率: 0%
浏览 1904
已结题

Windows Azure 获创建container报错

// 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)
怎么回事?

  • 写回答

3条回答 默认 最新

  • JamborYao_MSFT 2015-02-02 01:32
    关注

    Hi,

    从你贴出的代码来看没什么问题,我建议你去检查storage连接字符串,还有在代码的最后面加上一个条件判断句: “container.CreateIfNotExists();“,关于blob的具体使用,请阅读这篇文章: http://www.windowsazure.cn/zh-cn/develop/net/how-to-guides/blob-storage-v17/

    Best Regards,
    Jambor

    评论

报告相同问题?