4

I have strange problem with my API calls.

I'm writing WPF application with usage of RestSharp. All my calls to API uses RestSharp.

I have a Photos module, which downloads only urls of photos. From that URLs I'm creating BitmapSource objects.

I have a strange problem that all of API calls during loading of photos get timeout.

It's hot I'm creating BitmapSource objects:

Image = new BitmapImage(new Uri(url));

I have binded collection of Images to ItemsControl with Image control inside.

Have you ever got similar problems? Is that because of BitmapSource or RestSharp?

To fullfill the question: We're using Node.js + Sails.js on server side.

Travis Webb
  • 14,688
  • 7
  • 55
  • 109
Tomasz
  • 2,051
  • 3
  • 31
  • 64
  • That constructor of Bitmap source will download the image asynchronously, not sure what is causing it to hold up other threads. – Glen Thomas Aug 11 '15 at 19:59
  • Yep, I know that images are downloaded asynchronously. But why other API calls are blocked. I have been trying to find that out for couple of hours, without success – Tomasz Aug 11 '15 at 20:01
  • I have added details about our server implementation – Tomasz Aug 11 '15 at 20:03
  • Are the APIs that are blocked RestSharp APIs or WPF APIs? – Nick Mertin Aug 12 '15 at 02:58
  • 1
    I see no `RestSharp` here. I wonder if you actually know where the UI thread is blocking. I suggest using a profiler to find out. – Aron Aug 12 '15 at 02:58
  • I decided to not sharing my RestSharp calls code, it's just a simple calls. Does not matter which call I invoke, it's just not working. @MagikM18, I do not understand your question. – Tomasz Aug 12 '15 at 07:58
  • @Aron, Seems that my UI thread is not blocking, my UI is working fine. It looks like all other threads are blocked. – Tomasz Aug 12 '15 at 07:58
  • Ah, sorry, I reread your question, I see what you were saying now. It's probably that RestSharp prevents you from running multiple requests simultaneously, probably to avoid corrupting non-thread-safe resources continually required by the download. I have never used RestSharp, but if this is the case you might want to report it to its developers as a bug – Nick Mertin Aug 12 '15 at 11:22
  • More likely you are downloading from the same source. .net limits the number of requests per hostname. – Aron Aug 14 '15 at 19:29

0 Answers0