현재 앱을 만들고 있는데에 webjob을 작성하려고합니다. blob 저장소에 업로드 한 mp4 파일을 가져 와서 인코딩하고 하늘색 미디어 서비스를 사용하여 스트리밍 할 준비가 된 자산을 만듭니다. Azure Media Services Error 400
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
static string accName = "copied from portal ";
static string accKey = "as above";
static CloudMediaContext context = new CloudMediaContext(accName,accName);
// Use the cached credentials to create CloudMediaContext.
//static CloudMediaContext context = new CloudMediaContext(accName,accKey);
public static void ProcessVideo(
[QueueTrigger("videorequest")] VideoBlobInformation blobInfo,
[Blob("{ProfileId}/{BlobName}", FileAccess.Read)] Stream input,
[Blob("{ProfileId}/{BlobNameWithoutExtension}_stream.mp4")] CloudBlockBlob outputBlob)
{
VideoBlobInformation b = blobInfo;
using (Stream output = outputBlob.OpenWrite())
{
ConvertAndPrepareVideo(b,input, output);
}
// Entity Framework context class is not thread-safe, so it must
// be instantiated and disposed within the function.
using (impulsevidContext db = new impulsevidContext())
{
//var id = blobInfo.ProfileId;
//Video ad = db.Videos.Find(id);
//if (ad == null)
//{
// throw new Exception(String.Format("AdId {0} not found, can't create thumbnail", id.ToString()));
//}
//ad.StreamUrl = outputBlob.Uri.ToString();
//db.SaveChanges();
}
}
public static void ConvertAndPrepareVideo(VideoBlobInformation info,Stream input, Stream output)
{
var storageAccount = new CloudStorageAccount(new StorageCredentials("accnameofstorage", "storage account associated with azure media services"), true);
//output all webjob input blobs into a container -mediacontroller-
var cloudBlobClient = storageAccount.CreateCloudBlobClient();
var mediaBlobContainer = cloudBlobClient.GetContainerReference("impfile");
mediaBlobContainer.CreateIfNotExists();
IAsset sourceAsset = context.Assets.Where(a => a.Id == info.VideoId).First();
}
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.ProcessVideo ---> System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data) at System.Net.WebClient.UploadValues(String address, String method, NameValueCollection data) at Microsoft.WindowsAzure.MediaServices.Client.AcsTokenProvider.<>c__DisplayClass47_2.b__0() at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.b__0() at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func
1 func) at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction(Action action) at Microsoft.WindowsAzure.MediaServices.Client.AcsTokenProvider.RefreshToken() at Microsoft.WindowsAzure.MediaServices.Client.AcsTokenProvider.GetAccessToken() at Microsoft.WindowsAzure.MediaServices.Client.AcsTokenProvider.GetAuthorizationHeader() at Microsoft.WindowsAzure.MediaServices.Client.OAuth.OAuthDataServiceAdapter.AddAccessTokenToRequest(WebRequest request) at Microsoft.WindowsAzure.MediaServices.Client.AzureMediaServicesClassFactory.<>c__DisplayClass21_0.<GetAccountApiEndpoint>b__0() at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0() at Microsoft.WindowsAzure.MediaServices.Client.TransientFaultHandling.MediaRetryPolicy.ExecuteAction[TResult](Func
1 func) at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction(Action action) at Microsoft.WindowsAzure.MediaServices.Client.AzureMediaServicesClassFactory.GetAccountApiEndpoint(OAuthDataServiceAdapter dataServiceAdapter, ServiceVersionAdapter versionAdapter, Uri apiServer, UserAgentAdapter userAgentAdapter, IWebRequestAdapter clientRequestIdAdapter) at Microsoft.WindowsAzure.MediaServices.Client.AzureMediaServicesClassFactory.<>c__DisplayClass24_0.b__0() at Microsoft.WindowsAzure.MediaServices.Client.Cache1.GetOrAdd(String key, Func
1 valueFactory, Func1 expirationFactory) at Microsoft.WindowsAzure.MediaServices.Client.AzureMediaServicesClassFactory.CreateAzureMediaServicesEndPoint(Uri azureMediaServicesEndpoint, MediaContextBase mediaContext) at Microsoft.WindowsAzure.MediaServices.Client.AzureMediaServicesClassFactory..ctor(Uri azureMediaServicesEndpoint, CloudMediaContext mediaContext) at Microsoft.WindowsAzure.MediaServices.Client.CloudMediaContext.get_MediaServicesClassFactory() at Microsoft.WindowsAzure.MediaServices.Client.AssetCollection.<.ctor>b__2_0() at System.Lazy
1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy
1.get_Value() at Microsoft.WindowsAzure.MediaServices.Client.AssetCollection.get_Queryable() at Microsoft.WindowsAzure.MediaServices.Client.BaseCollection1.get_Provider() at System.Linq.Queryable.Where[TSource](IQueryable
1 source, Expression1 predicate) at VideoProcess.Functions.ConvertAndPrepareVideo(VideoBlobInformation info, Stream input, Stream output) at VideoProcess.Functions.ProcessVideo(VideoBlobInformation blobInfo, Stream input, CloudBlockBlob outputBlob) at lambda_method(Closure , Functions , Object[]) at Microsoft.Azure.WebJobs.Host.Executors.VoidMethodInvoker
1.InvokeAsync(TReflected instance, Object[] arguments) at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__13.MoveNext() --- End of inner exception stack trace --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__10.MoveNext()
파일/컨테이너 이름이 너무 깁니 까? – Mardoxx
아니요 blob 파일은 8486c644-7ed7-4f63-bba2-a8dd60c10bb1.mp4이고 컨테이너 이름은이 길이의 ID 필드입니다. f24d8371ef41e0b32ddc4da6f5aa84ef – TomMurphyDev
해결 되었습니까? – sabbour