4
votes

I am trying to set up a website under IIS 7.5 with multiple tcp.net bindings.

Since the service is behind a loadbalancer I need multiple endpoints for the service:

log.o1881.no/log/service.svc

log.core1.o1881.no/log/service.svc

this works for the http bindings when I configure in web.config:

<system.serviceModel>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

The following error message appears when the following tcp.net bindings are added to the site:

808:log.o1881.no

808:log.core1.o1881.no

Server Error in '/Log' Application.

This collection already contains an address with scheme net.tcp. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'. Parameter name: item

I also tried to add this to web.config:

<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
  <baseAddressPrefixFilters>
    <add prefix="net.tcp://log.o1881.no:808/log" />
    <add prefix="net.tcp://log.core1.o1881.no:808/log" />
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>

This does however not work.

Since the service will be deployed on multiple servers, I would very much like to be able to make this work through configuration and IIS setup, not in code.

Is this possible to do, or is there another way to handle this scenario (multiple binding names on http and net.tcp, due to loadbalancing)?

2
I've been trying the same thing for over a day now without any success. There's indeed lots of talk out there to on how to do it for http, but not for net.tcp. I'm starting to suspect this isn't possible. cfr. this post link "Multiple site binding is supported only for Http protocol"Stif
It's possible, but you must take care with your configuration and nut over configure.ktingle

2 Answers

1
votes

According to the documentation the use of multipleSiteBindingsEnabled tells WCF to ignore any <baseAddressPrefixFilters>.

"Any baseAddressPrefixFilters settings are ignored, for both HTTP and non-HTTP protocols, when multiple site bindings are enabled using this setting."

So this configuration contradicts itself, you are specifying address prefixes and simultaneously instructing WCF to ignore them since you are have multipleSiteBindingsEnabled specified.

<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
  <baseAddressPrefixFilters>
    <add prefix="net.tcp://log.o1881.no:808/log" />
    <add prefix="net.tcp://log.core1.o1881.no:808/log" />
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>

I think the multipleSiteBindingsEnabled is best for scenarios where you are only interested in using HTTP schemes.

Otherwise don't use it and you can in fact have multiple tcp.net bindings on different ports in the same IIS Site/App hierarchy.

<serviceHostingEnvironment>
  <baseAddressPrefixFilters>
    <add prefix="net.tcp://log.o1881.no:808/log" />
    <add prefix="net.tcp://log.core1.o1881.no:808/log" />
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>

Hope this helps others :)

0
votes

For as far as I've found, this is impossible:

If anyone finds a solution for this, please share...