Is GetResult
executed from the main thread? In that case, it may be a deadlock. If I remember correctly, the callback of the WebClient
is executed on the main thread, which cannot happen since you're blocking it by calling task.Result
.
You have multiple ways to prevent this issue:
Use a
HttpWebRequest
instead of aWebClient
Call
GetResult
from another threadExecute the task asynchronously by using
task.ContinueWith
instead of directlytask.Result
Rewrite your method using async/await keywords