Azure Blob: “The condition specified using HTTP conditional header(s) is not met”

后端 未结 3 681
温柔的废话
温柔的废话 2020-12-11 02:38

I got this exception when I run my application. It happens also in the real Azure blob storage.

I\'ve caught with Fiddler the request that creates this problem:

3条回答
  •  感情败类
    2020-12-11 03:14

    You can still use OpenRead, you need to pass OperationContext instance like below code:

    // cloudBlob instance of CloudPageBlob
    
     OperationContext context = new OperationContext();
     context.SendingRequest += (sender, e) => { 
         e.Request.Headers["if-match"] = "*";
     };
    
     using (AutoResetEvent waitHandle = new AutoResetEvent(false))
     {
         cloudBlob.StreamMinimumReadSizeInBytes = 16385;
         var result = cloudBlob.BeginOpenRead(null, null, context,
             ar => waitHandle.Set(),
             null);
         waitHandle.WaitOne();
         using (Stream blobStream = vhd.EndOpenRead(result))
         {
             var k = blobStream.ReadByte();
         }
     }
    

提交回复
热议问题