I'm trying to upload a image in Windows Azure Blob and I'm geting the following error which I can't handle.
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
The error occurs when I try to create a container.
container.CreateIfNotExists() Here is my code
try {     Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);     CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();       // Retrieve a reference to a container.      CloudBlobContainer container = blobClient.GetContainerReference("samples");      // Create the container if it doesn't already exist.     // here is the error     if (container.CreateIfNotExists())     {         container.SetPermissions(             new BlobContainerPermissions             {                 PublicAccess = BlobContainerPublicAccessType.Blob             });     }          CloudBlockBlob blockBlob = container.GetBlockBlobReference("Image1");     using (var fileStream = System.IO.File.OpenRead(@"Path"))     {         blockBlob.UploadFromStream(fileStream);     } } catch (StorageException ex1) {     throw ex1; } I have tried a lot of options in my code but still getting the error.
My PC's time was off by 1 hour as suggested by others in the comments. Correcting it solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With