I am trying to use HttpClient.PutAsync() to upload several images to Windows Azure storage at the same time. The code snippet looks like:
Task<HttpResponseMessage> putThumbnail = httpclient.PutAsync(new Uri(ThumbnailSas), thumbcontent);
Task<HttpResponseMessage> putImage = httpclient.PutAsync(new Uri(ImageSas), imagecontent);
Task.WaitAll(new Task<HttpResponseMessage>[] {putThumbnail, putImage});
Strangely in this way the server does not return at all so Task.WaitAll will wait forever.
if I change the code using await, the server returns and I can get the result correctly.
HttpResponseMessage result = await httpclient.PutAsync(new Uri(ThumbnailSas), thumbcontent);
How can I batch upload images using HttpClient.PutAsync?