【问题标题】:File uploading not working on Win phone 8 3G connection文件上传在 Win phone 8 3G 连接上不起作用
【发布时间】:2014-08-11 08:45:58
【问题描述】:

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

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。

我也尝试了另一种上传方式,但遇到了同样的错误。

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-27
      • 2016-01-18
      • 2019-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-03
      相关资源
      最近更新 更多