EN
本內容沒有您的語言版本,但有英文版本。
本主題尚未接受評分 - 為這個主題評分

Working with the Root Container

A root container serves as a default container for your storage account. A storage account may have one root container. The root container must be explicitly created and must be named $root.

A blob stored in the root container may be addressed without referencing the root container name, so that a blob can be addressed at the top level of the storage account hierarchy. For example, you can now reference a blob that resides in the root container in the following manner:

https://myaccount.blob.core.windows.net/mywebpage.html

To use the root container with your storage account, create a new container named $root. The following sample request shows how to create the root container:

var account = CloudStorageAccount.Parse("AccountName=myaccount;AccountKey=myaccountkey==;DefaultEndpointsProtocol=https");
var blobClient = account.CreateCloudBlobClient();
var blobContainer = blobClient.GetContainerReference("$root");
blobContainer.Create();

Like other containers, the root container can be made available for anonymous public access. If the root container is present, it will appear when you list containers in the storage account. When you list blobs in the root container, the root container does not appear in the resource URLs for the blobs returned. You can also delete the root container if you no longer need it.

ImportantImportant
A blob in the root container cannot include a forward slash (/) in its name, and be careful to avoid including a trailing forward slash (/) when referencing a blob under the root container. For example, using this URI results in an error:

https://myaccount.blob.core.windows.net/myblob/

In the above example, the Blob service reads the container name as myblob and expects to see a blob name after the trailing slash. The request is malformed due to the missing blob name.

To construct a URI for a blob named myphoto that resides in the root container:

https://myaccount.blob.core.windows.net/myphoto

You can also explicitly reference the root container:

https://myaccount.blob.core.windows.net/$root/myphoto

See Also

本文對您有任何幫助嗎?
(剩餘 1500 個字元)

社群新增項目

新增
© 2013 Microsoft. 著作權所有,並保留一切權利。
facebook page visit twitter rss feed newsletter