共用方式為


CosmosClientOptions.AccountInitializationCustomEndpoints Property

Definition

Gets and sets the custom endpoints to use for account initialization for geo-replicated database accounts in the Azure Cosmos DB service.

public System.Collections.Generic.IEnumerable<Uri> AccountInitializationCustomEndpoints { get; set; }
member this.AccountInitializationCustomEndpoints : seq<Uri> with get, set
Public Property AccountInitializationCustomEndpoints As IEnumerable(Of Uri)

Property Value

Examples

CosmosClientOptions clientOptions = new CosmosClientOptions()
{
    AccountInitializationCustomEndpoints = new HashSet<Uri>()
    { 
        new Uri("custom.p-1.documents.azure.com"),
        new Uri("custom.p-2.documents.azure.com") 
    }
};

CosmosClient client = new CosmosClient("endpoint", "key", clientOptions);

Remarks

During the CosmosClient initialization the account information, including the available regions, is obtained from the Endpoint. Should the global endpoint become inaccessible, the CosmosClient will attempt to obtain the account information issuing requests to the custom endpoints provided in AccountInitializationCustomEndpoints.

Nevertheless, this parameter remains optional and is recommended for implementation when a customer has configured an endpoint with a custom DNS hostname (instead of accountname-region.documents.azure.com) etc. for their Cosmos DB account.

See also Diagnose and troubleshoot the availability of Cosmos SDKs for more details.

Applies to