WebClient does not support concurrent I/O operations

前端 未结 4 2130
温柔的废话
温柔的废话 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:35

    The only answer is to create a new webclient within the scope of the Completed Event. You can't set it to new since webclient is readonly. Creating a new client is the only solution. This allows the old client to complete in the background. This does have slight memory implications since you are creating a new instance instead of reusing an old. But the garbage collector should keep it clean if your scope is setup right.

提交回复
热议问题