Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

WCF protocol configuration

Hi, I have a very simple WCF service application.

Where are a whole bunch of services, and they all "chatter" to each other using basicHttpBinding

The configuration looks something like this (I've changed it here from what it really is to keep it simple for my question).

    <services>
      <service name="com.company.testapp">
        <endpoint address="" binding="basicHttpBinding" contract="com.company.prod1.I12">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:80/CompanyName/ProductName/I1123" />
          </baseAddresses>
        </host>
      </service>
    </services>

Open in new window


Each of the services chatters to another WCF service application.

Some service applications are configured using basicHttpBinding.
Others are configured using WsHttpBinding, and netTcpBinding.

The reason for the differences is that the services are deployed on different computers, and there are some existing firewall rules that don't allow me to choose the same protocol etc for every service.

Some of my existing bindings also have timeouts, see http://msdn.microsoft.com/en-us/library/hh924831(v=vs.110).aspx

My question is is there a way to setup multiple bindings, so that

"magically" the service and the client (another service) try a whole bunch of bindings with timeouts configured and eventually fail over/find to the one that works and use that, ie. first try basicHttpBinding, with a timeout, if that works communicate that way, otherwise try the next one in the list, and so on and so on. When specifying netTcpBinding I would like to also specify - try these port number ranges, eg. 8000 - 8500 but not all the others.

Is this possible?
0
John Bolter
Asked:
John Bolter
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
I don't believe so, but you could certainly write code to accomplish this. When you create an instance of your client, the constructor is overloaded to accept the name of the endpoint you would like to use. You can wrap each successive call in a try/catch, and simply pass in whatever is in the name property of each endpoint as you create new clients.
0
 
John BolterAuthor Commented:
Some guy on Twitter posted earlier with these links that I read. I don't know whether it is what I want or not or what I'm describing.

http://geekswithblogs.net/shaunxu/archive/2012/07/06/service-discovery-in-wcf-4.0-ndash-part-1.aspx
0
 
käµfm³d 👽Commented:
The way that I'm reading that article, "service discovery" is more about, "Which distinct services are available to me, and where does each live?" It will tell you which endpoints are available, but it won't cycle through them if one fails. As I understand it, you could basically ditch all of that stuff that you have in the confg file--the service discovery agent would provide you with that information.
0
 
John BolterAuthor Commented:
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now