我正在从(.net)中的Azure Media Services v3调用Assets。ListContainerSasAsync,但是,没有明显的原因返回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
答案 0 :(得分:3)
该问题可能与到期时间有关。根据{{3}},到期时间必须少于24小时。对于寿命长的SAS URL,请使用Storage API。