我試圖將圖像文件(JPG)上載到Azure Blob存儲。我使用下面的代碼未從ASP.Net創建Azure Blob表單
var credentials = new StorageCredentials(name, key);
CloudStorageAccount cso = new CloudStorageAccount(credentials, true);
CloudBlobClient blobClient = cso.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("containerName");
string photoName = e_name + e_cr;
CloudBlockBlob blob = container.GetBlockBlobReference(photoName);
blob.Properties.ContentType = "image/jpg";
blob.UploadFromStreamAsync(img.OpenReadStream());
我的問題是,代碼實際上並沒有在我的容器中創建blob。我已經多次運行(昨天一次,今天大約三到四次),昨天晚上的嘗試成功了,但它不再有效。我已經爲我的容器嘗試了Blob和Container訪問類型,所以我不認爲是這樣。 IMG是IFormFile,和名稱,關鍵,photoName,e_name和e_cr都是字符串