BlobRequestOptions.LocationMode プロパティ

定義

要求の配置モードを取得または設定します。

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)

プロパティ値

要求の配置モードを示す LocationMode の列挙値です。

実装

// 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);

注釈

LocationMode は、ストレージ クライアントが要求を行おうとする場所を指定します。 これは、RA-GRS アカウント (プライマリ エンドポイントまたはセカンダリ エンドポイントからデータを読み取ることができるアカウント) でのみ有効です。

適用対象