1
을 제공하는 단계를 이어 http://social.msdn.microsoft.com/Forums/en-US/MediaServices/thread/9bcaf96d-3a47-4e76-8c95-3bd9200ba432 내 코드는 다음과 같습니다푸른 물방울을 복사하고 푸른 미디어 서비스에 주입 다른 BLOB 저장소 계정에서 미디어 서비스에 자산의 섭취에 대한 System.Data.Services.Client.DataServiceQueryException
CloudStorageAccount storageAccount = Microsoft.WindowsAzure.CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("AzureStorageString"));
private static readonly string _accountName = ConfigurationManager.AppSettings["accountName"];
private static readonly string _accountKey = ConfigurationManager.AppSettings["accountKey"];
public ActionResult UploadData(IEnumerable<HttpPostedFileBase> files)
{
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference("rawvideos");
if (blobContainer.CreateIfNotExist())
{
blobContainer.SetPermissions(new BlobContainerPermissions
{
PublicAccess = BlobContainerPublicAccessType.Blob
});
}
CloudMediaContext _context = new CloudMediaContext(_accountName, _accountKey);
Guid g = Guid.NewGuid();
IAsset assetToBeProcessed = _context.Assets.CreateEmptyAsset("YourAsset_" + g.ToString(), AssetCreationOptions.None);
IAccessPolicy writePolicy = _context.AccessPolicies.Create("Policy For Copying", TimeSpan.FromMinutes(30), AccessPermissions.Write | AccessPermissions.List);
ILocator destinationLocator = _context.Locators.CreateSasLocator(assetToBeProcessed, writePolicy, DateTime.UtcNow.AddMinutes(-5));
CloudBlobContainer sourceContainer = blobContainer;
CloudBlobContainer destinationContainer= blobClient.GetContainerReference("rawvideocopy");
if (destinationContainer.CreateIfNotExist())
{
blobContainer.SetPermissions(new BlobContainerPermissions
{
PublicAccess = BlobContainerPublicAccessType.Blob
});
}
foreach (var file in files)
{
CloudBlockBlob rawVideoFileRef= blobContainer.GetBlockBlobReference(file.FileName);
rawVideoFileRef.UploadFromStream(file.InputStream);
CloudBlob sourceFileBlob = sourceContainer.GetBlobReference(file.FileName);
sourceFileBlob.FetchAttributes();
long sourceLength = sourceFileBlob.Properties.Length;
CloudBlob destinationFileBlob= destinationContainer.GetBlobReference(file.FileName);
destinationFileBlob.CopyFromBlob(sourceFileBlob);
destinationFileBlob.FetchAttributes();
long destLength = destinationFileBlob.Properties.Length;
assetToBeProcessed.Publish();
assetToBeProcessed = RefreshAsset(_context,assetToBeProcessed);
}
return View();
}
assetToBeProcessed.Publish(); 당신은 당신의 destinationLocator에서 destinationFileBlob의 URL을 얻을 필요가
System.Data.Services.Client.DataServiceQueryException was unhandled by user code
HResult=-2146233079
Message=An error occurred while processing this request.
Source=Microsoft.Data.Services.Client
InnerException: System.Data.Services.Client.DataServiceClientException
HResult=-2146233079
Message=<?xml version="1.0" encoding="utf-8" standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>Internal Server Error</code><message xml:lang="en-US">Asset has no files uploaded.</message><innererror><message>Asset has no files uploaded.</message><type>System.ArgumentException</type><stacktrace> at Microsoft.Cloud.Media.Vod.Rest.Data.Repository.AssetRepository.InitMainFile(IDataStore dataStore, AssetRecord asset) in d:\Builds\100\IISMediaServices\Release_Official\Sources\Nimbus\Release\src\Vod\Rest\Data\Repository\AssetRepository.cs:line 346
당신은 올바른 코드를 바랍니다 보여줄 수 있을까? – Viacheslav