WebClient does not support concurrent I/O operations

前端 未结 4 2156
温柔的废话
温柔的废话 2020-11-30 09:45

How can I get this error from with in the DownloadStringCompleted Event? Doesn\'t that mean, it\'s finished? Is there another event I can fire this from?

I get this

4条回答
  •  盖世英雄少女心
    2020-11-30 10:15

    The solution, I found is to use multiple WebClient objects, so to modify your pseudocode example; try

    var client = new WebClient("URL 1");
    client.CompletedEvent += CompletedEvent;
    client.downloadasync();
    
    void CompletedEvent(){
    Dosomestuff;
    var client2 = new WebClient();
    client2.downloadasync(); 
    }
    

提交回复
热议问题