System.Net.WebClient只下载了81.4 MB(85,363,075字节)

4
[string] $fileName = "en_sql_server_2008_r2_developer_x86_x64_ia64_dvd_522665.iso"
[string] $url = "http://installers.abc/iso/$filename"
[string] $tempPath = "c:\balpreet"

function Download-Iso {
  Param(
    [string] $FileName,
    [string] $Url,
    [string] $destinationFolder 
  )

  [string] $destination = Join-Path -Path $tempPath -ChildPath $fileName 
  write-host "downloading from : $url to $destination"
    $client = new-object System.Net.WebClient
    $client.DownloadFile( $Url, $destination )

}

Download-Iso -FileName $fileName -Url $url -DestinationFolder = $tempPath

我试图从通过HTTP可以访问的远程位置下载4.07 GB(4,380,329,984字节)的ISO文件。
Windows 7中,它下载完整的4.07 GB文件。
Windows Server 2008 R2中,它只下载了81.4 MB(85,363,075字节),并假装已经完成了下载。代码没有抛出任何错误,但也没有完全下载文件。
有什么线索吗?

你的Windows Server 2008 R2系统的C盘是否可能出现了磁盘空间不足的情况? - alroc
1
这种情况也发生在其他文件上吗?我也遇到了一些公司防火墙的问题。在我的工作中,“智能”防火墙有时会认为某些文件是病毒,并终止连接……而且它总是在同一个点上终止连接。我唯一的解决办法是从家里下载文件,然后通过USB密钥带进来。 - HAL9256
1个回答

1
这是一个内部网络代理,由于某种原因,在传输81.4 MB(85,363,075字节)后丢弃了请求。但奇怪的是webclient没有抛出任何异常,并假装下载成功。 解决方法是将代理设置为空,以便请求不通过代理处理。
$client.proxy=$null  # get rid of proxy
$client.DownloadFile( $Url, $destination )

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接