[英]Can't create blob container on Azure Blob Storage
以下代碼在“ CreateIfNotExist”方法調用上引發錯誤。 我正在嘗試連接到我的Azure Blob存儲並創建一個名為“ images”的新容器
var storageAccount = new CloudStorageAccount(
new StorageCredentialsAccountAndKey("my_account_name", "my shared key"),
"https://blob.core.windows.net/",
"https://queue.core.windows.net/",
"https://table.core.windows.net/"
);
var blobClient = storageAccount.CreateCloudBlobClient();
var blobContainer = blobClient.GetContainerReference("images");
blobContainer.CreateIfNotExist();
錯誤是:
[StorageClientException: The requested URI does not represent any resource on the server.]
“圖像”容器不存在,但是我期望它可以創建而不是引發錯誤。 我究竟做錯了什么?
我嘗試使用HTTP而不是HTTPS,但是結果是相同的錯誤。
我發現我必須使用其他語法
var storageAccount = new CloudStorageAccount(
new StorageCredentialsAccountAndKey("my_account_name", "my shared key"));
var blobClient = storageAccount.CreateCloudBlobClient();
var blobContainer = blobClient.GetContainerReference("images");
blobContainer.CreateIfNotExists();
注意如何省略端點。 顯然,CloudBlobClient可以自動找出適當的URI。
您確定帳戶名和共享密鑰正確嗎? 您可以嘗試安裝Fiddler來查看HTTP流量,以確保那里沒有可疑的東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.