Issues with adding text to Append Blob


  • Hello,

    I would like to use append blob for storing browsing history per user. 

    Based on this post - I thought that I don't need to use blob leases since it says - "Append Blob supports having multiple clients writing to the same blob without any need for synchronization (unlike block and page blob)" 

    However, when I append text from multiple threads I got the following error : "The remote server returned an error: (412) The append position condition specified was not met.."

    This is my code:

        var storageAccount = CloudStorageAccount.Parse(connectionString);
        var blobClient = storageAccount.CreateCloudBlobClient();
        var container = blobClient.GetContainerReference(containerName);
        await container.CreateIfNotExistsAsync();
       var appendBlob =    container.GetAppendBlobReference(blobPath);
       if (!await appendBlob.ExistsAsync())
         await appendBlob.CreateOrReplaceAsync();
       await appendBlob.AppendTextAsync(text); 
       catch (Exception ex)
         _log.Error("Error in AddTextToAppendBlob", ex);

    I am not able to find good materials for append blob dealing with this issue.

    I guess the problem described above is an issue with the AppendTextAsync method. I found a work around for now that is described here - But it will be great if somebody from the team is able to give a little bit more information what is the right way to use AppendTextAsync.

    Thank you!


    Wednesday, September 9, 2015 5:44 AM