-3
当我尝试调用DownloadFileAsync时,我的程序崩溃,出现错误“WebClient不支持并发I/O操作”。我应该怎么做才能解决这个问题?WebClient不支持并发I/O错误
WebClient klient = new WebClient();
MatchCollection matches = Regex.Matches(storage, pattern);
Match[] odkazy = new Match[matches.Count];
List<string> neco = new List<string> { };
for (int i=0;i<matches.Count;i++)
{
matches.CopyTo(odkazy, 0);
string ano = odkazy[i].ToString();
neco.Add(ano);
klient.DownloadFileAsync(new Uri(neco[i]), @"c:\picture{0}.png",i);
Debug.WriteLine(neco[i]);
}
是否有错误信息...?你是否试图让我们调试你的代码? :P – 2014-09-25 21:32:26
在IntelliTrace中,它表示:异常:引发:“WebClient不支持并发I/O操作。” (System.NotSupportedException) 抛出了System.NotSupportedException:“WebClient不支持并发I/O操作。” – 2014-09-25 21:34:34