vb.net webclient class 抛出内存不足异常

vb.net webclient class throw an out of memory exception

我使用 VB.Net VisualStudio 2015 和 .net 4.5.2。

我使用 System.Net.WebClient class 通过方法 UploadFileAsync(address as URI, fileName as string) 将异步文件上传到网络服务器,但是当 fileSize 为太大了...

有什么想法吗?

谢谢!

已解决。

此处出现错误:

postStreamHeaders = boundary & vbCrLf & "Content-Disposition: form-data; name=""var1""" & vbCrLf & vbCrLf & "val1" & vbCrLf
postStreamHeaders = boundary & vbCrLf & "Content-Disposition: form-data; name=""var2""" & vbCrLf & vbCrLf & "val2" & vbCrLf
postStreamFooters = boundary & "--"

好的语法是:

postStreamHeaders = "--" & boundary & vbCrLf & "Content-Disposition: form-data; name=""var1""" & vbCrLf & vbCrLf & "val1" & vbCrLf
postStreamHeaders &= "--" & boundary & vbCrLf & "Content-Disposition: form-data; name=""var2""" & vbCrLf & vbCrLf & "val2" & vbCrLf
postStreamFooters = "--" & boundary & "--" & vbCrLf

希望这对其他人有帮助...