通过 basicHttpBinding 和 wsDualHttpBinding 托管的 WCF 回调服务
我有一个通过 wsDualHttpBinding 托管的回调服务。我希望添加一个客户端来轮询数据而不是接收回调(将是使用 wince 进行演示的移动设备)。我很好奇做到这一点的最佳方法是什么?您无法使用 NetCFSvcUtil 与 wsDualHttpBinding 托管的服务创建客户端代理(我理解),但您无法通过 basicHttpBinding 托管回调服务。我确实需要在 basicaHttpBinding (客户端将轮询数据)和 wsDualHttpBinding (回调将通知数据的客户端)上托管相同的服务。关于在不创建两个单独的服务来托管相同数据的情况下处理此问题的最佳方法有什么想法吗?
I have a callback service that is hosted over wsDualHttpBinding. I'm looking to add a client that will poll for the data rather than receive the callback (will be a mobile device using wince for demo purposes). I was curious what the best way to do this is? You cannot create a client proxy using NetCFSvcUtil with a service hosted with wsDualHttpBinding (I understand that), but you cannot host a callback service over basicHttpBinding. I really need the same service hosted over both basicaHttpBinding (clients will poll for data) and wsDualHttpBinding (callback will notify clients of data). Any ideas on the best way to handle this without creating two separate services to host the same data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
托管相同数据的两个独立服务是什么意思?您是否希望共享相同的服务实例来处理 wsDualHttpBinding 和 basicHttpBinding 请求?
您当前的问题是双工通信的服务接口不能用于 basicHttpBinding。您必须创建第二个服务合同并在同一服务中实施它。在这种情况下,您可以公开该服务的两个端点:一个使用 WSDualHttpBinding 双工,另一个使用 BasicHttpBinding。端点必须具有不同的相对地址。从客户端的角度来看,这些端点是单独的服务 - 每个端点都需要单独的客户端代理。因此,除非您的服务是单例的,否则您将为每个客户端代理拥有新的服务实例。新的服务实例意味着没有数据共享。
有一些可能性可以修改此行为,但这意味着替换实例提供程序。
What do you mean by two separate services hosting the same data? Do you expect to share same service instance to handle both wsDualHttpBinding and basicHttpBinding requests?
Your current problem is that service interface for duplex communication cannot be used for basicHttpBinding. You have to create second service contract and implement it in the same service. In that case you can expose two endpoints for the service: one duplex with WSDualHttpBinding and one with BasicHttpBinding. Endpoints must have different relative addresses. From the perspective of the client those endpoints are separate services - each of them requires separate client proxy. So unless your service is singleton you will have new service instance for each client proxy. New service instance means no data sharing.
Thera are some possibilities to modify this behavior but it means replacing Instance provider.