When working with Azure Storage I see there is a way to set a timeout on blob operations and on table operations if you are working with REST.
However we are working with C# client provided via WindowsAzure.Storage NuGet package (v8.4.0). And I don't see any way to specify a timeout here
var storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1"); // local storage for testing
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("mycontainer");
container.CreateIfNotExists();
var blobReference = container.GetBlockBlobReference("my/blob.pdf");
I've tried what looking through available properties/methods on CloudBlobClient
and on StorageAccount
, but did not find anything resembling timeout setting.
It would be ideal if I can set timout in one place (in connection string??) and that is used in all the operations. But how do I do this in C# client?
The maximum timeout interval for Queue service operations is 30 seconds. The Queue service automatically reduces any timeouts larger than 30 seconds to the 30-second maximum.
The following API calls are considered Write Operations: PutBlob, PutBlock, PutBlockList, AppendBlock, SnapshotBlob, CopyBlob and SetBlobTier (when it moves a Blob from Hot to Cool, Cool to Archive or Hot to Archive).
1. From the Azure portal, browse to storage account->Settings->Firewalls and virtual networks. By default, access will be set to “All networks.” Change this setting to “Selected networks” and click on “Add existing virtual network” to restrict access to Azure endpoints.
The BlobServiceClient allows you to manipulate Azure Storage service resources and blob containers. The storage account provides the top-level namespace for the Blob service.
Do take a look at ServerTimeout
property in BlobRequestOptions
class.So your code would be:
var storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1"); // local storage for testing
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("mycontainer");
container.CreateIfNotExists(new BlobRequestOptions()
{
ServerTimeout = TimeSpan.FromSeconds(90)
});
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