【问题标题】:Multiple WCF Services (self hosted)多个 WCF 服务(自托管)
【发布时间】:2010-11-19 16:00:55
【问题描述】:

我有一组在 Windows 服务中托管的 WCF 服务。

我需要运行多个实例 - 这很好,我可以使用唯一的端点来做到这一点,但是对于给定的实例,我需要知道它是哪个实例。

例如我可能有端点:

net.tcp://localhost:9000/Customer1/MyServerFunctions

net.tcp://localhost:9001/Customer2/MyServerFunctions

当调用 WCF 服务时,我需要知道它是用于 Customer1 还是 Customer2

建议?

【问题讨论】:

  • 你想运行相同合约的多个实例吗?上述实例是提供相同的合同方式还是针对不同的客户不同?

标签: .net wcf


【解决方案1】:

你的服务实现可以调用

OperationContext.Current.Channel.LocalAddress

确定请求来自哪个客户端点。

【讨论】:

  • 谢谢,这很有帮助。我想一定有类似的东西可用。
猜你喜欢
  • 1970-01-01
  • 2012-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-07
相关资源
最近更新 更多