Pause/Resume Upload in C#(在 C# 中暂停/恢复上传)
问题描述
我正在寻找一种通过 C# 的 WebClient 暂停或恢复上传过程的方法.
I'm looking for a way to pause or resume an upload process via C#'s WebClient.
伪代码:
WebClient Client = new WebClient();
Client.UploadFileAsync(new Uri("http://mysite.com/receiver.php"), "POST", "C:MyFile.jpg");
也许像..
Client.Pause();
有什么想法吗?
推荐答案
WebClient
没有这种功能 - 即使是稍微低级的 HttpWebRequest
也没有不,据我所知.您将需要使用一个 HTTP 库,它可以让您在事情发生时更好地控制确切(当然,这也将涉及更多代码).WebClient
的重点是提供一个非常简单的 API 以在非常简单的情况下使用.
WebClient
doesn't have this kind of functionality - even the slightly-lower-level HttpWebRequest
doesn't, as far as I'm aware. You'll need to use an HTTP library which gives you more control over exactly when things happen (which will no doubt involve more code as well, of course). The point of WebClient
is to provide a very simple API to use in very simple situations.
这篇关于在 C# 中暂停/恢复上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 C# 中暂停/恢复上传
基础教程推荐
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- MS Visual Studio .NET 的替代品 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01