Udostępnij za pośrednictwem


中国Azure媒体服务RESTAPI的Endpoint

Amber Zhao  Thu, Feb 26 2015 4:09 AM 

由于海外Azure和中国Azure有不同的domain,很多用户在使用媒体服务RESTAPI时,需要指定中国Azure媒体服务的Endpoint。本篇文章主要介绍,如何快速查找中国媒体服务的Endpoint:

  1. 登陆中国Azure的门户,进入媒体服务账号的页面,并点击“以编程方式上载视频”

            

    2. 如下示例代码为中黄线的部分为中国Azure媒体服务的上海的Endpoint

 // Create a .NET console app // Set the project properties to use the full .NET Framework (not Client Profile)
 // With NuGet Package Manager, install windowsazure.mediaservices
 // add: using Microsoft.WindowsAzure.MediaServices.Client;
 var uploadFilePath = @"YOUR FILE PATH";
 // For hitting the Shanghai API endpoint, use "https://wamsshaclus001rest-hs.chinacloudapp.cn/API/", for Beijing use "https://wamsbjbclus001rest-hs.chinacloudapp.cn/API/" var context = new CloudMediaContext( new Uri("https://wamsshaclus001rest-hs.chinacloudapp.cn/API/"), "Your storage account", "Your storage account key", "urn:WindowsAzureMediaServices", "https://wamsprodglobal001acs.accesscontrol.chinacloudapi.cn"); var uploadAsset = context.Assets.Create(Path.GetFileNameWithoutExtension(uploadFilePath), AssetCreationOptions.None); var assetFile = uploadAsset.AssetFiles.Create(Path.GetFileName(uploadFilePath)); assetFile.Upload(uploadFilePath); 

   3. 总结Azure媒体服务中国北部和中国东部的Endpoint信息如下:

中国东部 AMS API Server:

https://wamsshaclus001rest-hs.chinacloudapp.cn/API/

中国北部 AMS API Server:

https://wamsbjbclus001rest-hs.chinacloudapp.cn/API/

ACSBaseAddress:

https://wamsprodglobal001acs.accesscontrol.chinacloudapi.cn

备注:CloudMediaContext的定义如下:

public CloudMediaContext(Uri apiServer, string accountName, string accountKey, string scope, string acsBaseAddress)

具体源代码请参考如下github链接:https://github.com/Azure/azure-content/blob/master/articles/media-services-dotnet-connect_programmatically.md

如果你有任何疑问,欢迎访问MSDN社区,由专家来为您解答Windows Azure各种技术问题,或者拨打世纪互联客户服务热线400-089-0365/010-84563652咨询各类服务信息。

本文转载自: https://blogs.msdn.com/b/cciccat/archive/2015/02/26/azure-china-media-service-restapi-endpoint.aspx