I get an exception which I cannot get rid of, despite reading other threads about it, changing names etc etc.
An exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in Microsoft.WindowsAzure.Storage.dll but was not handled in user code.
HomeController code:
public ActionResult Upload() { CloudBlobContainer blobContainer = _Service.GetCloudBlobContainer(); CloudTable table = _Service.GetCloudTable(); List<string> blobs = new List<string>(); foreach (var item in blobContainer.ListBlobs()) { var picName = Request.Form["name"]; var picPath = item.Uri.ToString(); PictureEntity picture = new PictureEntity(picPath, picName); picture.Timestamp = DateTime.Now; picture.Description = Request.Form["desc"]; TableOperation insertOperation = TableOperation.Insert(picture); table.Execute(insertOperation); // BOOOOOOOM HERE!!! picturesList.Add(picture); blobs.Add(picPath); } return View(picturesList); }
[HttpPost]
public ActionResult Upload(HttpPostedFileBase image)
{
if (image.ContentLength > 0)
{
// Behöver man göra något här
CloudBlobContainer blobContainer = _Service.GetCloudBlobContainer();
CloudBlockBlob blob = blobContainer.GetBlockBlobReference(image.FileName);
blob.UploadFromStream(image.InputStream);
}
return RedirectToAction("Upload");
}
table.Execute(insertOperation)
is the one which causes the crash.
if (blobContainer.CreateIfNotExists())also causes some problem and giving the same exception.
I guess you could thread it but I aint that experienced coder yet so I can figure that one out.
Make my friday and tell me what do I dooo...*sob* :-)
Best regards, Joel