I am coding an MVC5 application, and am uploading BlockBlobs
to Azure
.
I have some Microsoft code that is now obsolete, and I wish to convert this obsolete code to code that will work in my application.
Here is the old code:
BlockBlob.PutBlock(blockId, chunkStream, null, null, new BlobRequestOptions() { RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(10)) });
I have code that does work, however this code does not use a RetryPolicy
.
Here is the code with no RetryPolicy
:
BlockBlob.PutBlock(blockId, chunkStream, null, null, null, null);
Can I please have some help to construct the BlobRequestOptions
object correctly that uses a RetryPolicy
?
Here is what I have so far:
BlobRequestOptions blobRequestOptions = new BlobRequestOptions();
blobRequestOptions.RetryPolicy.CreateInstance();
TimeSpan timeSpan = new TimeSpan();
TimeSpan.FromSeconds(10);
blobRequestOptions.RetryPolicy.ShouldRetry(3, 0, new Exception(), out timeSpan, new OperationContext());
I am not sure of the following:
- What status code to use.
- What to use for the LastException.
- The out value for the timespan.
- What to use for OperationContext.
Thanks in advance.