开发者

Asynchronous WCF calls from Silverlight

开发者 https://www.devze.com 2022-12-17 02:34 出处:网络
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 r

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 reason开发者_运维知识库s for this?


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.

0

精彩评论

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