Reputation: 1876
I am using Silverlight 5.0 and WCF 4.0 with entity framework 4.0. My design is as follows - Silverlight client calls a service agent(this is just a wrapper to a in process WCF service) through normal synchronous method call. THe service agent inturn calls a WCF service which is configured with a custombinding with binary encoding and httptransport. This WCF service is hoested in the same application as Silverlight and the calls from service agent is being made through "operationame"Async methods. Theservice agent has custom events that will be fired when "operation"Completed method is called. This service agent event will be handled by silverlight. This WCF service again makes a call to a distributed WCF service using "operationame"Async method.
My silverlight application has four different widgets in the screen and they make four calls to the service agent. The four calls from the service agent are being triggered parallely to the in process WCF service. But from the in process WCF service the calls are being made sequentially to the ditributed wcf service. I just checked with fiddler which shows that in process wcf is making sequential calls to ditributed wcf service. I would like to make it in parallel. Can somebody please help. The problem is my server is processing them ony by one as against running them in parallel. I confirmed this through fiddler where i saw the calls were arriving at the WCF sequentially. The WCF distributed service is configured as a percall with concurrencymode single and webhttpbinding.
Also does anybody have any resource/links to understand how the silverlight / wcf threading model works. I am interested in knowing if proxymethodAsync call is spawning a new thread?If not how does it work without blocking the UI thread?
Upvotes: 1
Views: 536
Reputation:
HTTP Calls (which I'm guessing your WCF calls are being made over) are NOT Asynchronous.
Your code issues an Async call - but the Silverlight runtime (or the browser) handles that connection synchronously for you. Only upon return does it then issue a callback to your code.
There are also limitations on the number of connctions that can be made at once - this is a browser and/or runtime limitation. Usually the limit is two active connections.
So, if you need to make many calls, you should wrap those up, and send them as a batch to the server.
Upvotes: 4