bodyreader.ReadToEnd() 대용량 파일을 내 메모리/localdisk에 저장하지 않고 DROPBPOX에서 다운로드하고 싶습니다. Parallel.Forloop을 사용하여 여러 파일을 다운로드하고 있습니다.읽기 작업이 실패했습니다. 대용량 파일 DROPBOX API 스트림 만 사용하는 Azure BlobUpload
public static DropboxClient dropboxClient;
var response = await dropboxClient.Files.DownloadAsync(file[0]);
var fileStream = await response.GetContentAsStreamAsync();
try {
container = obj.BloBHandle();
table = obj.TableHandle();
StreamReader bodyReader = new StreamReader(filepath);
string bodyString = bodyReader.ReadToEnd();
block = container.GetBlockBlobReference(filename);
int blockSize = 4 * 1024 * 1024; //256 kb
int fileSize = bodyString.Length;
//long fileSize = filepath.Length;
//block count is the number of blocks + 1 for the last one
int blockCount = (int)((float)fileSize/(float)blockSize) + 1;
//List of block ids; the blocks will be committed in the order of this list
List<string> blockIDs = new List<string>();
//starting block number - 1
int blockNumber = 0;
int bytesRead = 0; //number of bytes read so far
long bytesLeft = fileSize; //number of bytes left to read and upload
//do until all of the bytes are uploaded
while (bytesLeft > 0)
{
blockNumber++;
int bytesToRead;
if (bytesLeft >= blockSize)
{
//more than one block left, so put up another whole block
bytesToRead = blockSize;
}
else
{
//less than one block left, read the rest of it
bytesToRead = (int)bytesLeft;
}
//create a blockID from the block number, add it to the block ID list
//the block ID is a base64 string
string blockId =
Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(string.Format("BlockId{0}",
blockNumber.ToString("0000000"))));
blockIDs.Add(blockId);
//set up new buffer with the right size, and read that many bytes into it
byte[] bytes = new byte[bytesToRead];
filepath.Read(bytes, 0, bytesToRead);
// Stream stream = new MemoryStream(bytesToRead);
//calculate the MD5 hash of the byte array
string blockHash = GetMD5HashFromStream(bytes);
//upload the block, provide the hash so Azure can verify it
block.PutBlock(blockId, new MemoryStream(bytes), blockHash);
//increment/decrement counters
bytesRead += bytesToRead;
bytesLeft -= bytesToRead;
}
//commit the blocks
block.PutBlockList(blockIDs);
}
catch (Exception ex)
{
}
는 우리는 그냥 나중에 업로드되는 파일의 50 %를 최대 개까지 큰 파일을 성공적으로 & 업로드되는 작은 파일이 사항은이
block = container.GetBlockBlobReference(filename);
block.UploadFromStream(stream);
처럼
을 UploadFromStream 블록하지 않고 시도
요청이 중단되었습니다. 내 메모리/localdisk에 저장하지 않고 DROPBPOX에서 큰 파일을 다운로드하려면() bodyreader.ReadToEnd : 아래의 코드에 실패