NullReferenceException in System.Threading.Tasks calling HttpClient.GetAsync(url)

前端 未结 3 811
陌清茗
陌清茗 2020-12-29 09:24

I have a strange problem in my MVC 4.0 application. I use REST web services (Amazon Associate) . I created a method, which I use from everywhere. The shortened version is th

3条回答
  •  青春惊慌失措
    2020-12-29 10:10

    When I was getting the exception and call stack shown above, it was because I was trying to do a "fire and forget" execution using async, which was a really bad idea. I switched to spinning of a new thread for what I wanted and the crashes went away.

提交回复
热议问题