All about wcf client

不羁岁月 提交于 2019-12-11 05:01:27

问题


When I deploy the same service on different machines as they have different information that I need , how can I use my client gracely to consume these service .


回答1:


You need to define the service endpoint you want to connect to in your client's config.

You cannot define a list of endpoints - if you need load-balancing features, you need to implement those on the server side and "hide" them behind a single service endpoint.

With .NET 4 and WCF 4, you have new capabilities you could check out:

  • WCF 4 has a new routing service which you can use to get called on a single URL, and you have control over how to "distribute" those calls to the actual back-end servers

  • WCF 4 also supports dynamic service discovery, so you could potentially just "yell out onto the network" and get back one service endpoint address that supports your contract you're interested in

Resources:

  • Developer's Introduction to WCF 4

  • 10-4 Show on WCF 4 Routing Service

  • Content-based routing with WCF 4
  • WCF 4.0 Routing Service
  • WCF 4.0 Routing Service - Failover

  • Using WS-Discovery in WCF 4.0

  • Ad-hoc Discovery with Probing messages



回答2:


It sounds like you want to connect to BOTH servers. you say they have different data that you need. Well, if you already know how to make a client to one of them, the easiest way is to define an entire other client to access the second one. You can define as many clients as you want in the config file. Then just call them both in code.



来源:https://stackoverflow.com/questions/3896436/all-about-wcf-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!