开发者

All about wcf client

开发者 https://www.devze.com 2023-01-19 13:26 出处:网络
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 .You need to define the

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 .


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


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.

0

精彩评论

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

关注公众号