Webclient's DownloadStringCompleted event handler never called

后端 未结 2 1843
执笔经年
执笔经年 2021-01-22 03:29

I\'m trying to make an asynchronous HTTP GET request using Webclient, however, the registered callback never gets called. I\'ve also tried with the sync one, and it worked fine.

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-22 04:26

    The simpliest solution is to add Console.ReadKey() at the end of AsyncWebRequest(url) method. This way asyncWebRequest.DownloadStringAsync(url) will be able to retrieve data.

提交回复
热议问题