Partager via


BlobRequestOptions.LocationMode Propriété

Définition

Obtient ou définit le mode d'emplacement de la demande.

public Microsoft.Azure.Storage.RetryPolicies.LocationMode? LocationMode { get; set; }
member this.LocationMode : Nullable<Microsoft.Azure.Storage.RetryPolicies.LocationMode> with get, set
Public Property LocationMode As Nullable(Of LocationMode)

Valeur de propriété

Valeur d'énumération LocationMode indiquant le mode d'emplacement de la demande.

Implémente

Exemples

// The PrimaryOnly LocationMode directs the request and all potential retries to go to the primary endpoint.
BlobRequestOptions locationModeRequestOptions = new BlobRequestOptions() { LocationMode = RetryPolicies.LocationMode.PrimaryOnly };
byteCount = blob.DownloadToByteArray(destinationArray, index: 0, accessCondition: null, options: locationModeRequestOptions);

// The PrimaryThenSecondary LocationMode directs the first request to go to the primary location.
// If this request fails with a retryable error, the retry will next hit the secondary location.
// Retries will switch back and forth between primary and secondary until the request succeeds, 
// or retry attempts have been exhausted.
locationModeRequestOptions = new BlobRequestOptions() { LocationMode = RetryPolicies.LocationMode.PrimaryThenSecondary };
byteCount = blob.DownloadToByteArray(destinationArray, index: 0, accessCondition: null, options: locationModeRequestOptions);

// The SecondaryOnly LocationMode directs the request and all potential retries to go to the secondary endpoint.
locationModeRequestOptions = new BlobRequestOptions() { LocationMode = RetryPolicies.LocationMode.SecondaryOnly };
byteCount = blob.DownloadToByteArray(destinationArray, index: 0, accessCondition: null, options: locationModeRequestOptions);

// The SecondaryThenPrimary LocationMode directs the first request to go to the secondary location.
// If this request fails with a retryable error, the retry will next hit the primary location.
// Retries will switch back and forth between secondary and primary until the request succeeds, or retry attempts
// have been exhausted.
locationModeRequestOptions = new BlobRequestOptions() { LocationMode = RetryPolicies.LocationMode.SecondaryThenPrimary };
byteCount = blob.DownloadToByteArray(destinationArray, index: 0, accessCondition: null, options: locationModeRequestOptions);

Remarques

LocationMode spécifie les emplacements dans lesquels le client de stockage tentera d’effectuer la demande. Cela n’est valide que pour les comptes RA-GRS, c’est-à-dire les comptes où les données peuvent être lues à partir du point de terminaison principal ou secondaire.

S’applique à