文件上传无法在Win phone 8 3G连接上运行

时间:2014-08-11 08:45:59

标签: c# windows-phone-8 file-upload 3g

我有一个应用程序,用户可以录制视频和api将录制的视频上传到azure。我使用下面的代码

HttpClientHandler handler = new HttpClientHandler();
handler.MaxRequestContentBufferSize = int.MaxValue;
using (HttpClient httpClient = new HttpClient(handler) 
   { 
        MaxResponseContentBufferSize = int.MaxValue
   })
{
  MultipartFormDataContent content = new MultipartFormDataContent();
  content.Add(new ByteArrayContent(chunks), "file", fileName);
  HttpResponseMessage response = null;
  response = await httpClient.PostAsync(new Uri(url), content);
  return await response.Content.ReadAsStringAsync();
}

仅当连接为wifi或3G视频小于10秒时才有效。当我尝试上传大小约20-30 MB的视频时,它失败了。作为回应,我得到了状态代码404 Not Found。

我还尝试了另一种上传方法但遇到了同样的错误。

1 个答案:

答案 0 :(得分:0)

最后,我更改了我的api代码并发送了1 MB的块请求。

相关问题