webclient.downloadfileasync无法下载完整文件

时间:2015-07-20 12:18:33

标签: vb.net

我正在尝试使用webclient.downloadfileasync下载文件,但它只下载16 kb文件的完整大小约为500kb

这是我的代码:

Imports System.Net
Imports System.IO
Imports System.Threading
Module Module1
  Private WithEvents thttp As WebClient
    Sub main()
     Try
        thttp = New WebClient
        thttp.DownloadDataAsync(New Uri("URL"), IO.Path.GetTempPath &  "\app.exe")
        Thread.Sleep(5000)
        Try
            If System.IO.File.Exists(IO.Path.GetTempPath & "\app.exe") =  True Then
                MsgBox("Update Complete")
            Else
                MsgBox("Update Failed")
            End If
        Catch ex As Exception
        End Try
    Catch ex As Exception
    End Try
  End Sub
End Module

0 个答案:

没有答案