问题描述
当我在不同的机器上部署相同的服务时,因为它们具有所需的不同信息,我如何才能优雅地使用客户端来使用这些服务.
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.
使用.NET 4和WCF 4,您可以检出新功能:
With .NET 4 and WCF 4, you have new capabilities you could check out:
-
WCF 4提供了一个新的路由服务,您可以使用该服务在单个URL上进行调用,并且可以控制如何将这些调用分发"到实际的后端服务器
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还支持动态服务发现,因此您可以向网络大喊大叫"并获取一个支持您感兴趣的合同的服务端点地址
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
资源:
这篇关于关于WCF客户端的所有信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!