We use BigIP to load balance between our two IIS servers. We recently deployed a WCF service hosted on by IIS 6 onto these two Windows Server 2003R2 servers.
我们使用BigIP在两台IIS服务器之间进行负载均衡。我们最近将IIS 6托管的WCF服务部署到这两台Windows Server 2003R2服务器上。
Each server is configured with two host headers: one for the load balancer address, and then a second host header that points only to that server. That way we can reference a specific server in the load balanced group for debugging.
每个服务器配置有两个主机头:一个用于负载平衡器地址,另一个主机头仅指向该服务器。这样我们就可以引用负载均衡组中的特定服务器进行调试。
So when we run We immediately got the error:
所以当我们运行时我们立刻得到了错误:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. Parameter name: item
此集合已包含方案http的地址。此集合中每个方案最多只能有一个地址。参数名称:item
I did some research and we can implement a filter to tell it to ignore the one of the hosts, but then we cannot access the server from that address.
我做了一些研究,我们可以实现一个过滤器来告诉它忽略其中一个主机,但是我们无法从该地址访问服务器。
<serviceHostingEnvironment> <baseAddressPrefixFilters> <add prefix="http://domain.com:80"/> </baseAddressPrefixFilters></serviceHostingEnvironment>
What is the best solution in this scenario which would allow us to hit a WCF service via http://domain.com/service.svc and http://server1.domain.com/service.svc?
在这种情况下,什么是最佳解决方案,允许我们通过http://domain.com/service.svc和http://server1.domain.com/service.svc获取WCF服务?
If we should create our own ServiceFactory as some sites suggest, does anyone have any sample code on this?
如果我们应该像某些网站建议的那样创建我们自己的ServiceFactory,那么有没有人有任何示例代码?
Any help is much appreciated.
任何帮助深表感谢。
EDIT: We will need to be able to access the WCF service from either of the two addresses, if at all possible.
编辑:如果可能的话,我们需要能够从两个地址中的任何一个访问WCF服务。
Thank you.
谢谢。
3 个解决方案
#1
1
On your bigIP Create 2 new virtual servershttp://server1.domain.com/http://server2.domain.com/
在你的bigIP上创建2个新的虚拟服务器http://server1.domain.com/http://server2.domain.com/
create a pool for each VS with only the specific server in it - so there will be no actual load balancing and access it that way. If you are short on external IP'S you can still use the same IP as your production domain name and just use an irule to direct traffic to the appropriate pool
为每个VS创建一个只有特定服务器的池 - 因此没有实际的负载平衡并以这种方式访问它。如果您缺少外部IP,您仍然可以使用与生产域名相同的IP,并使用irule将流量定向到适当的池
Hope this helps
希望这可以帮助
#2
0
The URL it uses is based on the bindings in IIS. Does the website have more than one binding? If it does, or is the WCF service used by multiple sites? If it is, then you are SOL AFAIK. We ran into this issue. Basically, there can be only one IIS binding for HTTP, otherwise it bombs.
它使用的URL基于IIS中的绑定。该网站是否有多个绑定?如果是,或者是多个站点使用的WCF服务?如果是,那么你就是SOL AFAIK。我们遇到了这个问题。基本上,HTTP只能有一个IIS绑定,否则就会爆炸。
Also, here's info on implementing a ServiceHostFactory. That WILL work if it's possible that your WCF service only be accessible through 1 address (unfortunately for us, this was not possible).
另外,这里有关于实现ServiceHostFactory的信息。如果您的WCF服务可能只能通过1个地址访问(对我们来说不幸,这是不可能的),这将有效。
#3
0
When you need to test a specific machine, you could "bypass" the load balancing and ensure the correct host-header is sent to keeep WCF happy by editing the "hosts" file on the machine you're testing from so, for example:
当您需要测试特定的计算机时,您可以“绕过”负载平衡,并通过编辑您正在测试的计算机上的“hosts”文件来确保将正确的主机标头发送给keeep WCF,例如:
10.0.0.11 through 10.0.0.16 are the six hosts that are in the cluster "cluster.mycompany.local", with a load balanced IP address of 10.0.0.10. When testing you could add a line to the machines hosts file that says "10.0.0.13 cluster.mycompany.local" to be able to hit the third machine in the cluster directly.
10.0.0.11到10.0.0.16是群集“cluster.mycompany.local”中的六个主机,负载平衡IP地址为10.0.0.10。测试时,您可以在机器主机文件中添加一行“10.0.0.13 cluster.mycompany.local”,以便能够直接命中集群中的第三台机器。
#1
1
On your bigIP Create 2 new virtual servershttp://server1.domain.com/http://server2.domain.com/
在你的bigIP上创建2个新的虚拟服务器http://server1.domain.com/http://server2.domain.com/
create a pool for each VS with only the specific server in it - so there will be no actual load balancing and access it that way. If you are short on external IP'S you can still use the same IP as your production domain name and just use an irule to direct traffic to the appropriate pool
为每个VS创建一个只有特定服务器的池 - 因此没有实际的负载平衡并以这种方式访问它。如果您缺少外部IP,您仍然可以使用与生产域名相同的IP,并使用irule将流量定向到适当的池
Hope this helps
希望这可以帮助
#2
0
The URL it uses is based on the bindings in IIS. Does the website have more than one binding? If it does, or is the WCF service used by multiple sites? If it is, then you are SOL AFAIK. We ran into this issue. Basically, there can be only one IIS binding for HTTP, otherwise it bombs.
它使用的URL基于IIS中的绑定。该网站是否有多个绑定?如果是,或者是多个站点使用的WCF服务?如果是,那么你就是SOL AFAIK。我们遇到了这个问题。基本上,HTTP只能有一个IIS绑定,否则就会爆炸。
Also, here's info on implementing a ServiceHostFactory. That WILL work if it's possible that your WCF service only be accessible through 1 address (unfortunately for us, this was not possible).
另外,这里有关于实现ServiceHostFactory的信息。如果您的WCF服务可能只能通过1个地址访问(对我们来说不幸,这是不可能的),这将有效。
#3
0
When you need to test a specific machine, you could "bypass" the load balancing and ensure the correct host-header is sent to keeep WCF happy by editing the "hosts" file on the machine you're testing from so, for example:
当您需要测试特定的计算机时,您可以“绕过”负载平衡,并通过编辑您正在测试的计算机上的“hosts”文件来确保将正确的主机标头发送给keeep WCF,例如:
10.0.0.11 through 10.0.0.16 are the six hosts that are in the cluster "cluster.mycompany.local", with a load balanced IP address of 10.0.0.10. When testing you could add a line to the machines hosts file that says "10.0.0.13 cluster.mycompany.local" to be able to hit the third machine in the cluster directly.
10.0.0.11到10.0.0.16是群集“cluster.mycompany.local”中的六个主机,负载平衡IP地址为10.0.0.10。测试时,您可以在机器主机文件中添加一行“10.0.0.13 cluster.mycompany.local”,以便能够直接命中集群中的第三台机器。