none
Upload media throw (500) Internal Server Error RRS feed

  • Question

  • Hello,

    I am trying to use .net sdk to upload media files, but I always got some error like:

    AggregateException was unhandled

    {"The remote server returned an error: (500) Internal Server Error."}

       at Microsoft.WindowsAzure.MediaServices.Client.TaskExtensions.ThrowIfFaulted(Task task, Action faultedCallback)
       at Microsoft.WindowsAzure.MediaServices.Client.TaskExtensions.ThrowIfFaulted(Task task)
       at Microsoft.WindowsAzure.MediaServices.Client.AssetFileData.PostUploadAction(Task task, String path, CancellationToken token)
       at Microsoft.WindowsAzure.MediaServices.Client.AssetFileData.<>c__DisplayClassd.<UploadAsync>b__a(Task ts)
       at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()

    Anyone has some idea of the reason? I also noticed the upload was really slow -- for a file of 60MB, it took 15 minutes then got the above error.

    My code is simply from the demo code, like:

        var assetName = Path.GetFileNameWithoutExtension(singleFilePath);
       
    IAsset inputAsset = _context.Assets.Create(assetName, assetCreationOptions);

       
    var assetFile = inputAsset.AssetFiles.Create(Path.GetFileName(singleFilePath));

       
    Console.WriteLine("Created assetFile {0}", assetFile.Name);

       
    var policy = _context.AccessPolicies.Create(
                                assetName
    ,
                               
    TimeSpan.FromDays(30),
                               
    AccessPermissions.Write | AccessPermissions.List);

       
    var locator = _context.Locators.CreateLocator(LocatorType.Sas, inputAsset, policy);

       
    Console.WriteLine("Upload {0}", assetFile.Name);

        assetFile
    .Upload(singleFilePath);
       
    Console.WriteLine("Done uploading {0}", assetFile.Name);

        locator
    .Delete();
        policy
    .Delete();

    Thanks

    Sunday, January 3, 2016 12:19 AM

All replies

  • Just some update: I noticed that, for small files (100-200M), it is less likely to get the error.

    For larger files (I am using a test 1.2G file, which is about 5 minutes of HD content coming from my camcorder), it always gets the error, but sometimes, the error will be different, like:

    A first chance exception of type 'System.AggregateException' occurred in mscorlib.dll

       at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
       at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpWebResponse resp, T retVal, StorageCommandBase`1 cmd, Exception ex)
       at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.<PutBlockImpl>b__3e(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
       at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)

    Sunday, January 3, 2016 7:51 AM
  • Hi

    Can you please share your Media Services account name and region in which the account exists?

    Thursday, January 7, 2016 6:47 PM