我有transform
下载.chm文件(如下面的代码所示)。它下载的内容似乎非常不规律。完整文件大小约为2500-2600 KB,但大约50-75%的时间我得到的文件较小(例如:1233 KB,657 KB,353 KB,1745 KB等)。
(代码简化/个人详细信息已删除)
WebClient
事件,工作正常,但在“未完成”的文件:
public static void DownloadMyFile(string destFileAndPath)
{
//Get base for help Url, stop at first "/" ignoring "https://", then add path in server
string Url = "https://mywebservice.com/myFile.chm";
using (var client = new WebClient())
{
//I need to do stuff to the downloaded file when done
client.DownloadFileCompleted += client_DownloadFileCompleted;
client.DownloadFileAsync(new Uri(Url), destFileAndPath);
//More waiting?
while (client.IsBusy) { }
}
}
我真的错过了什么吗?