OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Microsoft.WindowsAzure.Storage.StorageException: The condition specified using HTTP conditional header(s) is not met

  • Thread starter Thread starter bab951
  • Start date Start date
B

bab951

Guest
i m getting error on CopyToAsync when filelist is having more than 1 file in case of 1 file it is working fine. issue could be related to concurrency i am not sure about that solution will be really appreciated

Code:
        CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(_configuration["AzureBlobStorage"]);
        CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
        CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference("interestgroupattachment");
        var blockBlob = cloudBlobContainer.GetBlockBlobReference(filename);

        using (var stream = await blockBlob.OpenWriteAsync())
        using (var zip = new ZipArchive(stream, ZipArchiveMode.Create))
        {
            var files = fileNames;
            foreach (var docfile in fileList)
            {
                using (var fstream = docfile)
                {
                    var entry = zip.CreateEntry(fileNames[counter], CompressionLevel.Optimal);
                    using (var innerFile = entry.Open())
                    {
                        await fstream.CopyToAsync(innerFile);
                    }
                }
                counter++;
            }
        }
<p>i m getting error on CopyToAsync when filelist is having more than 1 file in case of 1 file it is working fine. issue could be related to concurrency i am not sure about that solution will be really appreciated</p>
<pre><code> CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(_configuration["AzureBlobStorage"]);
CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference("interestgroupattachment");
var blockBlob = cloudBlobContainer.GetBlockBlobReference(filename);

using (var stream = await blockBlob.OpenWriteAsync())
using (var zip = new ZipArchive(stream, ZipArchiveMode.Create))
{
var files = fileNames;
foreach (var docfile in fileList)
{
using (var fstream = docfile)
{
var entry = zip.CreateEntry(fileNames[counter], CompressionLevel.Optimal);
using (var innerFile = entry.Open())
{
await fstream.CopyToAsync(innerFile);
}
}
counter++;
}
}
</code></pre>
Continue reading...
 

Latest posts

M
Replies
0
Views
1
Mohit Pant
M
Top