WCF 服务是否在 Windows Phone 7 中的 UI 线程或异步请求线程上运行?
由于问题指出访问 WCF 服务时使用哪个线程?
我订阅的大多数 Web 服务都使用了 HttpWebRequest,因为它不会阻塞 UI 线程。但是当我访问 Bing API 时,它使用 WCF 服务。这是 WebClient 或 HttpWebRequest 的实现吗?
从外观上看,它看起来更像 WebClient,因为它不需要您调用 BeginInvoke 将数据封送到 UI 线程?这准确吗?
As the question states which thread is used when accessing a WCF service?
Most web services that I have been subscribing to I have used HttpWebRequest because it doesn't block the UI thread. But when I access the Bing API it uses a WCF service. Is this an implementation of WebClient or HttpWebRequest?
From the outside it looks more like WebClient because it does not require you to call BeginInvoke to marshal the data to the UI thread? Is this accurate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Windows Phone 上没有 WCF 服务 - 该平台中的 API 仅包含 WCF 的客户端部分的代码(访问服务)。
您不能同时使用
HttpWebRequest
和WebClient
来阻止 UI 线程(例如,分别使用BeginGetResponse
和DownloadAsync
) 。如果我没记错的话,手机中的WCF客户端在内部使用HttpWebRequest
,但这是一个实现细节,它可以随时更改。来自Windows Phone 平台(以及Silverlight)的所有WCF 调用都需要异步(即,没有同步支持)。There's no WCF service on a Windows Phone - the API in that platform only contain the code for the client part of WCF (accessing services).
You can not block the UI thread with both
HttpWebRequest
andWebClient
(e.g., usingBeginGetResponse
andDownloadAsync
, respectively). If I remember correctly, the WCF client in the phone usesHttpWebRequest
internally, but that's an implementation detail, it can be changed at any time. And all WCF calls from the Windows Phone platform (and Silverlight as well) need to be asynchronous (i.e., there's no synchronous support).