This topic describes how to configure an endpoint in Alibaba Cloud Darabonba SDK for .NET.
An endpoint is a domain name of an Alibaba Cloud service API. For example, an endpoint of Elastic Compute Service (ECS) can be ecs.cn-hangzhou.aliyuncs.com. Each Alibaba Cloud service has its unique endpoints. Each endpoint of a service may vary based on regions.
Configure an endpoint
The Darabonba SDK provides two comprehensible addressing modes for endpoints. The following list describes the addressing modes by priority in descending order:
User-defined addressing mode: In this mode, you can specify an exact endpoint when you initialize an SDK client. You can query an endpoint by visiting
OpenAPI Explorer. For more information about how to query an endpoint in OpenAPI Explorer, see the "Query an endpoint" section of this topic.
config.Endpoint = "ecs-cn-hangzhou.aliyuncs.com";
2. Concatenation-based addressing mode: This mode takes effect only if the SDK of an Alibaba Cloud service has an endpoint data file. Otherwise, TeaException is thrown and the error message config.endpoint can not be empty
is returned when you initialize an SDK client. In this case, you must use the user-defined addressing mode to specify an exact endpoint. For more information about an example of an endpoint data file, see ECS endpoint data file. If the region that you want to access is not included in the data file, the endpoint of the region is generated in the ${The code of the Alibaba Cloud service}.${The region ID}.aliyuncs.com
format.
config.RegionId = "<regionId>";
Appendix: Query an endpoint
You can query an endpoint in OpenAPI Explorer.
Select an Alibaba Cloud service, such as ECS, on the homepage of OpenAPI Explorer.
2. Click the Regions tab.
3. Find the region that you want to specify and copy the endpoint of the region.
You can also use the following method to query an endpoint:
On the API Debugging tab of OpenAPI Explorer, find the API operation that you want to call and configure the RegionId parameter. OpenAPI Explorer automatically generates SDK sample code from which you can obtain the endpoint.