来自 Blob 存储的 Azure 媒体服务

azure media services from blob storage

我找到了一些相关的答案,但 none 解释了我是否真的需要来自 https://azure.microsoft.com/en-us/documentation/articles/media-services-copying-existing-blob/ 的 Azure 媒体服务团队示例的所有代码 我只想将文件从 blob 上传到 Azure 媒体服务。像这样:

  var uploadFilePath = blobUrl;
  var uploadAsset = _context.Assets.Create(Path.GetFileNameWithoutExtension(uploadFilePath), AssetCreationOptions.None);
  var assetFile = uploadAsset.AssetFiles.Create(Path.GetFileName(uploadFilePath));
  assetFile.Upload(uploadFilePath);

但我得到

AggregateException was unhandled by user code, "An exception of type 'System.AggregateException' occurred in mscorlib.dll but was not handled in user code"

堆栈跟踪

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.WindowsAzure.MediaServices.Client.AssetFileData.Upload(String path) at UploadMediaServicesExample.Services.MediaHandler.AddFileToMediaServices(String blobUrl) in C:\Source\UploadMediaServicesExample\UploadMediaServicesExample\Services\MediaHandler.cs:line 51 at UploadMediaServicesExample.Controllers.HomeController.UploadVideo(IEnumerable1 file) in C:\Source\UploadMediaServicesExample\UploadMediaServicesExample\Controllers\HomeController.cs:line 24 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.b__3f()

附加信息:出现一个或多个错误。

这是 public.."https://mulimo.blob.core.windows.net/temporary-files/clip.mp4"

的 blob Uri

资产文件上传方法不支持从 blob 上传。它仅适用于本地文件。关于异常,您应该在内部异常消息 属性 中看到消息。您可以使用 azure 媒体服务扩展(或查看它是如何完成的)https://github.com/Azure/azure-sdk-for-media-services-extensions 从现有 blob 创建资产。