WCF RIA Services waiting on a Single thread?
Can someone explain me why this is happening?
- Silverlight 4 application using WCF Ria Services
SL app calls
开发者_Python百科 Due to synchronization issues with external components there is aStartLongOperation
[Invoke]
operation.Thread.Sleep(30 * 1000)
in the server-side code.SL app calls
GetStatus
(standard query) operation. These calls appear to be blocked server-side and are waiting for theStartLongOperation
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.
精彩评论