我找到了一些相关的答案,但没有一个解释我是否真的需要https://azure.microsoft.com/en-us/documentation/articles/media-services-copying-existing-blob/的Azure媒体服务团队示例中的所有代码 我只想将文件从blob上传到Azure Media Services。像这样:
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未被用户代码处理,"类型异常 ' System.AggregateException'发生在mscorlib.dll但不是 用户代码"
处理
堆栈跟踪
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, 取消语音取消语言) Microsoft.WindowsAzure.MediaServices.Client.AssetFileData.Upload(字符串 路径) UploadMediaServicesExample.Services.MediaHandler.AddFileToMediaServices(字符串 blobUrl)in C:\来源\ UploadMediaServicesExample \ UploadMediaServicesExample \ SERVICES \ MediaHandler.cs:行 51点 UploadMediaServicesExample.Controllers.HomeController.UploadVideo(IEnumerable
1 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, IDictionary
2个参数)at 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.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult) asyncResult)at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() 在 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult的 asyncResult)at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() 在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters&LT;&GT; c__DisplayClass46.b__3f()
其他信息:发生了一个或多个错误。
这是一个公开的blob Uri。&#34; https://mulimo.blob.core.windows.net/temporary-files/clip.mp4&#34;
答案 0 :(得分:1)
资产文件上传方法不支持从blob上传。它只适用于本地文件。关于异常,您应该在内部异常消息属性中看到消息。您可以使用azure媒体服务扩展(或查看它是如何在那里完成的)https://github.com/Azure/azure-sdk-for-media-services-extensions从现有blob创建资产。