你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ConnectionMode Enum

Definition

Represents the connection mode to be used by the client when connecting to the Azure Cosmos DB service.

public enum ConnectionMode
type ConnectionMode = 
Public Enum ConnectionMode
Inheritance
ConnectionMode

Fields

Name Value Description
Gateway 0

Use the Azure Cosmos DB gateway to route all requests to the Azure Cosmos DB service. The gateway proxies requests to the right data partition.

Direct 1

Uses direct connectivity to connect to the data nodes in the Azure Cosmos DB service. Use gateway only to initialize and cache logical addresses and refresh on updates

Examples

CosmosClient client = new CosmosClient(connectionString, new CosmosClientOptions { ConnectionMode = ConnectionMode.Gateway });

Remarks

Direct and Gateway connectivity modes are supported. Direct is the default.

Applies to