All Products
Search
Document Center

Initialization

Last Updated: Jul 11, 2019

Prerequisites

Initialization

The regionId parameter specifies the region of ApsaraVideo for VOD. Set this parameter to cn-shanghai for a region in China.

using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Profile;

public static DefaultAcsClient InitVodClient(string accessKeyId, string accessKeySecret)
{
    // Sets the region of ApsaraVideo for VOD.
    string regionId = "cn-shanghai";
    IClientProfile profile = DefaultProfile.GetProfile(regionId, accessKeyId, accessKeySecret);
    // DefaultProfile.AddEndpoint(regionId, regionId, "vod", "vod." + regionId + ".aliyuncs.com");
    return new DefaultAcsClient(profile);
}

Instructions

  • Assume that the region ID that you specify is in the list of ApsaraVideo for VOD regions and endpoints. Due to the incompatibility of some SDK versions, the system may return the error message SDK.InvalidRegionId, Can not find endpoint to access. when you call the InitVodClient method. To resolve this issue, you can uncomment the line of code for calling the AddEndpoint method in the InitVodClient method.