Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asynchronous WCF calls from Silverlight

I've noticed that you can only call a WCF service from Silverlight asynchronously. This seems to be a pretty sound practice, especially when deploying over the internet, but I'm wondering why this restriction has been placed on the architecture. Is it purely to enforce good practice, or are there technical reasons for this?

like image 506
Craig Schwarze Avatar asked Feb 28 '23 18:02

Craig Schwarze


1 Answers

Essentially it's because Silverlight runs on the Browser Window UI Thread. Which means that if Silverlight is synchronously waiting for a reply - the whole browser window is non-responsive at that time.

Additionally, Silverlight originally (Silverlight 2) only had a Client Browser Communication stack.
Which means, that all communication in Silverlight was routed through the browser.
Browsers don't support synchronous programming models for communication.

That's less of a problem with the Silverlight 3+ Non-Browser Client communication stack, but it still makes sense to keep that programming model in place.

like image 94
JustinAngel Avatar answered Mar 07 '23 01:03

JustinAngel