2014-01-06 82 views
1

我在使用Azure媒體服務時遇到了一些問題。我已成功設法將文件上載到Azure Media Service並將其編碼爲mp4,但這隻會在visual studio中的localhost上起作用。當我將以下代碼部署到Azure虛擬機,Windows Datacenter 2012版時,該文件被上傳,但編碼作業永遠不會創建在部署到服務器(iis8)後創建Azure媒體服務作業失敗

任何幫助非常感謝!

這是我用它來創建工作代碼:

   // Declare a new job. 
       job= _context.Jobs.Create("New Job"); 

       // Get a media processor reference, and pass to it the name of the 
       // processor to use for the specific task. 
       IMediaProcessor processor = GetLatestMediaProcessorByName("Windows Azure Media Encoder"); 

      // Create a task with the encoding details, using a string preset. 
      ITask task = job.Tasks.AddNew("LSVEncodingTask_" + v.CompanyId + "_user" + v.UserId, 
       processor, 
       "H264 Broadband 1080p", 
       TaskOptions.ProtectedConfiguration); 

      // Specify the input asset to be encoded. 
      task.InputAssets.Add(asset); 

      // Add an output asset to contain the results of the job. 
      // This output is specified as AssetCreationOptions.None, which 
      // means the output asset is not encrypted. 
      task.OutputAssets.AddNew("output asset", 
       AssetCreationOptions.None); 

      // Use the following event handler to check job progress. 
      job.StateChanged += new 
       EventHandler<JobStateChangedEventArgs>(StateChanged); 

      // Launch the job. 
      job.Submit(); 

      // Check job execution and wait for job to finish. 
      Task progressJobTask = job.GetExecutionProgressTask(CancellationToken.None); 

編輯:

做了一些挖掘(登錄...),發現堆棧跟蹤:

System.Security.Cryptography.CryptographicException: Access is denied. 

    at System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags) 
    at Microsoft.WindowsAzure.MediaServices.Client.EncryptionUtils.SaveCertificateToStore(X509Certificate2 certToStore) 
    at Microsoft.WindowsAzure.MediaServices.Client.ContentKeyBaseCollection.GetCertificateForProtectionKeyId(IMediaDataServiceContext dataContext, String protectionKeyId) 
    at Microsoft.WindowsAzure.MediaServices.Client.JobData.ProtectTaskConfiguration(TaskData task, X509Certificate2& certToUse, IMediaDataServiceContext dataContext) 
    at Microsoft.WindowsAzure.MediaServices.Client.JobData.InnerSubmit(IMediaDataServiceContext dataContext) 
    at Microsoft.WindowsAzure.MediaServices.Client.JobData.SubmitAsync() 
    at Microsoft.WindowsAzure.MediaServices.Client.JobData.Submit() 
    at Livescreen.Domain.Implementation.AzureMediaManager.CreateEncodingJob(IAsset asset, String inputMediaFilePath, String outputFolder, Int32 videoId) 
+0

告訴我們你到目前爲止試圖診斷/調試的問題?有像Fiddler這樣的工具可以很好地跟蹤Web請求。有像Windows事件日誌這樣的東西可以查找可疑條目,等等。請嘗試先自行解決問題,然後在此處介紹嘗試的解決方案以及失敗代碼/堆棧跟蹤,以便提供幫助。 – astaykov

回答

0

找到解決方案here

當在IIS7上運行時 - 您可以指定加載App Pool的用戶配置文件。這使您可以訪問應用程序 池帳戶的每個用戶存儲。

解決方案:

The solution