private string UploadToBlob() { // TableTest(); CloudStorageAccount storageAccount = CloudStorageAccount.Parse( "connectionstring"); CloudFileClient fileClient = storageAccount.CreateCloudFileClient(); CloudFileShare share = fileClient.GetShareReference("fileshare"); CloudFileDirectory rootDir = share.GetRootDirectoryReference(); int size = 5 * 1024 * 1024; byte[] buffer = new byte[size]; Random rand = new Random(); rand.NextBytes(buffer); CloudFile file = rootDir.GetFileReference("Log3.txt"); file.UploadFromByteArrayAsync(buffer, 0, buffer.Length); string result = "aa"; //Begins an asynchronous operation to upload the contents of a byte array to a file. If the file already exists on the service, it will be overwritten. var res = file.BeginUploadFromByteArray(buffer, 0, buffer.Length, ProcessInformation, result); //Ends an asynchronous operation to upload the contents of a byte array to a file. //wait for the BeginUploadFromByteArray method execute completely then continue run the codes file.EndUploadFromByteArray(res); return(""); }