在Azure Media Services中创建资产

时间:2016-04-18 03:27:17

标签: asp.net-mvc azure

我正试图在我的MVC 5 Web App中创建一个Azure资产,但它失败了。

IAsset asset = context.Assets.Create("anynameyouwant", AssetCreationOptions.None);
IAccessPolicy writePolicy = context.AccessPolicies
                                   .Create("writePolicy", TimeSpan.FromMinutes(120), AccessPermissions.Write);
ILocator destinationLocator = context.Locators
                                    .CreateLocator(LocatorType.Sas, asset, writePolicy);

我的堆栈跟踪表明这是创建令牌的问题。

at Microsoft.WindowsAzure.MediaServices.Client.MediaServicesCredentials.<>c__DisplayClass9.<RefreshToken>b__4()
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0()
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction(Action action)
at Microsoft.WindowsAzure.MediaServices.Client.MediaServicesCredentials.RefreshToken()
at Microsoft.WindowsAzure.MediaServices.Client.OAuth.OAuthDataServiceAdapter.RefreshToken()
at Microsoft.WindowsAzure.MediaServices.Client.OAuth.OAuthDataServiceAdapter.AddAccessTokenToRequest(WebRequest request)
at Microsoft.WindowsAzure.MediaServices.Client.AzureMediaServicesClassFactory.<>c__DisplayClass7.<GetAccountApiEndpoint>b__6()

我是Azure的新手,我花了一天时间试图弄清楚如何解决这个问题,所以如果有人能帮助我,我会非常感激。

1 个答案:

答案 0 :(得分:0)

您是否在代码中指定了MediaServicesCredentials并配置了访问密钥?看看是否已经Get started with delivering content on demand using .NET SDK。您还可以查看the error codes以获取有关您遇到的错误的一些线索。