Azure Media Services v3 Assets.ListContainerSasAsyn c возвращает ApiErrorException - PullRequest
0 голосов
/ 25 февраля 2020

Я звоню Активам. ListContainerSasAsyn c из Azure Media Services v3 in (. net), однако APIErrorException возвращается без видимой причины. Я трижды проверил, у меня есть действительные параметры config.ResourceGroup, config.AccountName и assetName.

Код:

AssetContainerSas assetContainerSas = await client.Assets.ListContainerSasAsync(config.ResourceGroup, config.AccountName, assetName, permissions: AssetContainerPermission.Read, expiryTime: DateTime.UtcNow.AddYears(1).ToUniversalTime());

Исключение:

-       $exception  {"Operation returned an invalid status code 'InternalServerError'"} Microsoft.Azure.Management.Media.Models.ApiErrorException
+       Body    {Microsoft.Azure.Management.Media.Models.ApiError}  Microsoft.Azure.Management.Media.Models.ApiError
+       Data    {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
        HResult -2146233088 int
        HelpLink    null    string
-       InnerException  null    System.Exception
-       Static members      
+       Non-Public members      
        Message "Operation returned an invalid status code 'InternalServerError'"   string
+       Request {Microsoft.Rest.HttpRequestMessageWrapper}  Microsoft.Rest.HttpRequestMessageWrapper
-       Response    {Microsoft.Rest.HttpResponseMessageWrapper} Microsoft.Rest.HttpResponseMessageWrapper
        Content "{\r\n  \"error\": {\r\n    \"code\": \"InternalServerError\",\r\n    \"message\": \"The server encountered an internal error. Please try again later.\"\r\n  }\r\n}"   string
+       Headers Count = 17  System.Collections.Generic.IDictionary<string, System.Collections.Generic.IEnumerable<string>> {System.Collections.Generic.Dictionary<string, System.Collections.Generic.IEnumerable<string>>}
        ReasonPhrase    "Internal Server Error" string
        StatusCode  InternalServerError System.Net.HttpStatusCode
        Source  "Microsoft.Azure.Management.Media"  string
        StackTrace  "   at Microsoft.Azure.Management.Media.AssetsOperations.<ListContainerSasWithHttpMessagesAsync>d__10.MoveNext()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Azure.Management.Media.AssetsOperationsExtensions.<ListContainerSasAsync>d__11.MoveNext()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at App.MediaLibrary.Service.Services.AzureMediaServicesService.<GetVideoUrlsAsync>d__10.MoveNext() in C:\\Users\\Martin\\Documents\\Projects\\x-a\\b\\c\\MediaLibrary\\Service\\Services\\AzureMediaServicesService.cs:line 108"   string
+       TargetSite  {Void MoveNext()}   System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
+       Static members      
+       Non-Public members      

1 Ответ

3 голосов
/ 25 февраля 2020

Вероятно, проблема связана со временем истечения. Согласно https://docs.microsoft.com/en-us/rest/api/media/assets/listcontainersas#request -body expiryTime должно быть меньше 24 часов. Для долгоживущих URL-адресов SAS используйте API хранилища.

...