开发者

WCF RIA Services waiting on a Single thread?

Can someone explain me why this is happening?

  1. Silverlight 4 application using WCF Ria Services
  2. SL app calls StartLongOperation [Invoke] operation.

    开发者_Python百科 Due to synchronization issues with external components there is a Thread.Sleep(30 * 1000) in the server-side code.

  3. SL app calls GetStatus (standard query) operation. These calls appear to be blocked server-side and are waiting for the StartLongOperation to complete. Why??

I was assuming that serverside, the StartLongOperation runs an a worker thread and each call to GetStatus would run on a seperate worker thread. Client-side the calls are async so SL fires off the StartLongOperation and then continues to poll the GetStatus. But the GetStatusCompleted doesn't get fired until the StartLongOperation has completed.


Since all Silverlight network communication happens on the UI thread, only one WCF call can happen at a time. Meaning your StartLongOperation has to complete, and then the client will start the GetStatus call. If you want to test this behavior, fire up Fiddler. You will find that Silverlight will not send an HTTP request to the GetStatus method until it first gets a StartLongOperation response from the server.

So the problem isn't server-side. It's a limitation of Silverlight.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜