简体   繁体   English

实施Web服务回调

[英]Implementing a web service callback

I have a winforms C# desktop application. 我有一个winforms C#桌面应用程序。 I have a polling web service to my server to retrieve messages as and when they come in. Is there a way of implementing a callback web service from my desktop to the server instead of polling the web service? 我有一个轮询Web服务到服务器,以在消息进入时检索消息。是否有一种方法可以实现从桌面到服务器的回调Web服务,而不是轮询Web服务? Is this what asynchronous web services are about? 这就是异步Web服务的含义吗?

Thanks 谢谢

There are several approaches to achieve this: one the one Hand, you can start a request to the server with a very long timeout. 有几种方法可以实现此目的:一种是单手操作,您可以在很长的超时时间内向服务器发起请求。 Let the server wait for a new message (and assert that the request does not timeout on the Server side) and return the request once there is one. 让服务器等待新消息(并断言该请求在服务器端未超时),并在有一个新消息时返回该请求。 If the request times out, issue a new one. 如果请求超时,请发出新请求。
In WCF, there are some other techniques like Duplex Services to solve this. 在WCF中,还有其他一些技术(例如双工服务)可以解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM