Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the bindingConfiguration attribute responsible for in a BasicHttpBinding endpoint config?

Tags:

wcf

So I am working with configuring endpoints for a WCF service. I have almost no experience with services as a whole, but have been plopped in the middle of a project that uses them. I roughly understand what each attribute in the endpoint is doing except for one. "bindingConfiguration".

Here's an obscured version of my code (actual information is proprietary):

      <endpoint address="http://localhost/SomeService.svc"
           binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISomeService"
           contract="SomeService.ICoreService" name="BasicHttpBinding_ISomeService" />

Here's MSDN's take on it (as in they don't specifically address it).

Microsoft's incomplete MSDN Entry

Of course Stackoverflow has a few questions containing a string match for "bindingConfiguration" but none explicetely address my question:

Most relative (I think) Stackoverflow question

Any ideas on what this is used for?

In the interest of learning I am willing to take a stab and be wrong here. I think it has something to with authentication or security. On Inspection of the Interface I notice nothing pertaining to this either.

Any help would be great!

Cheers

Matt

like image 912
Mathew A. Avatar asked Aug 12 '11 17:08

Mathew A.


People also ask

What is binding configuration in WCF?

Bindings are objects that are used to specify the communication details that are required to connect to the endpoint of a Windows Communication Foundation (WCF) service. Each endpoint in a WCF service requires a binding to be well-specified.

What is Basichttpbinding?

NET Framework. Defines a binding that a WCF service can use to configure and expose endpoints to communicate with services conforming to the WS-I Basic Profile 1.1.


1 Answers

In your bindings section, you can have multiple "configurations" for the same binding type (in your case, basicHttpBinding). The binding configuration chooses among them which one to use.

In MSDN, you should try to find the reference for <endpoint> (since bindingConfiguration is is attribute), that will have a definition of what the attribute is supposed to do.

In the example below, the service defines two endpoints, both using basicHttpBinding. One of them is exposed over "normal" HTTP, the other is exposed over HTTPS. The bindingconfiguration attribute is the one which tells WCF which configuration to use.

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="SimpleBasic">
                <security mode="None"/>
            </binding>
            <binding name="BasicOverHttps">
                <security mode="Transport"/>
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service name="MyNamespace.MyService">
            <endpoint address="ep"
                      binding="basicHttpBinding"
                      bindingConfiguration="SimpleBasic"
                      contract="MyNamespace.IService" />
            <endpoint address="secure"
                      binding="basicHttpBinding"
                      bindingConfiguration="BasicOverHttps"
                      contract="MyNamespace.IService" />
        </service>
    </services>
</system.serviceModel>
like image 68
carlosfigueira Avatar answered Nov 15 '22 08:11

carlosfigueira