[英]How to upload a large file as chunk in azure media service using only c#?
我正在嘗試將文件上傳到azure媒體服務(控制台應用程序)中,如果文件大小較小,我可以使用以下正常的上傳方法
static public IAsset CreateAssetAndUploadSingleFile(AssetCreationOptions assetCreationOptions, string singleFilePath)
{
if (!File.Exists(singleFilePath))
{
Console.WriteLine("File does not exist.");
return null;
}
var assetName = Path.GetFileNameWithoutExtension(singleFilePath);
IAsset inputAsset = _context.Assets.Create(assetName, assetCreationOptions);
var assetFile = inputAsset.AssetFiles.Create(Path.GetFileName(singleFilePath));
Console.WriteLine("Upload {0}", assetFile.Name);
assetFile.Upload(singleFilePath);
Console.WriteLine("Done uploading {0}", assetFile.Name);
return inputAsset;
}
這會將文件上傳到azure媒體服務中,但是如果文件太大,想要將其拆分成塊並需要上傳,我應該進行哪些更改以僅使用c#來實現此目的。
我看過一個使用javascript解釋此問題的鏈接(我不知道) gaurav的鏈接 。 我如何使用C#實現類似。
請幫忙。
查看有關上傳多個文件的部分。 它允許您調整SDK內置的BobTransferClient使用的線程數
var blobTransferClient = new BlobTransferClient();
blobTransferClient.NumberOfConcurrentTransfers = 20;
blobTransferClient.ParallelTransferThreadCount = 20;
另一個選擇是僅獲取SAS URL,直接上傳到Blob Storage的容器中,然后使用用作AzCopy工具基礎組件的Azure Storage Net Data移動庫。 這使您可以完全控制並行上傳,塊大小,並發線程等。為您提供所有功能和旋鈕!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.