HttpWebRequest synchronous on Windows Phone 8

前端 未结 2 395
忘了有多久
忘了有多久 2021-01-21 11:39

In order to design / reuse a library usable both for WPF apps, Windows Phone 8 apps and later Windows 8 / RT apps, we need to make some HttpWebRequest call, preferably synchrono

2条回答
  •  抹茶落季
    2021-01-21 12:14

    The HttpWebRequest use UI thread to process a request, don't ask me why.

    So if you try to wait a result by lock the UI thread, you will get a deadlock condition, because you lock UI thread until request is not complete and request will not be complete while UI thread is locked.

提交回复
热议问题