bindingConfiguration vs bindingName

devlife picture devlife · Sep 20, 2011 · Viewed 26.3k times · Source

What exactly is the difference between bindingConfiguration and bindingName elements in a WCF endpoint element? The reason that I ask is I am creating an endpoint which uses basicHttpBinding and SSL. I configured the web.config like this:

<basicHttpBinding>
<binding name="basicHttps">
  <security mode="Transport">
    <transport clientCredentialType="None"/>
  </security>
</binding>

<endpoint binding="basicHttpBinding" bindingConfiguration="basicHttps" contract="Hsp.Services.Interface.Catalog.ICatalogService" address="" />

However, when using bindingConfiguration then https isn't working. When I change bindingConfiguration to bindingName it works as expected. So, what exactly is the difference between the two?

Answer

marc_s picture marc_s · Sep 20, 2011

The binding= attribute just defines, which binding (protocol) you want - basicHttpBinding, wsHttpBinding, netTcpBinding etc.

Those bindings all have system default values - if you don't specify any binding configuration, those system defaults will be used.

What you've defined in your <bindings> section of your config is a binding configuration - a set of parameters for your binding of choice that will be used instead of the system defaults.

So the binding= and the bindingConfiguration= need to match - you cannot define one binding (e.g. basicHttpBinding) but then assign a binding configuration for a different binding.

That however still doesn't explain why your https doesn't work - that must be some other problem. Can you elaborate a bit more? How does it not work? Just no response, or do you get an error (if so: what is that error??)