This is a mirror of official site: http://jasper-net.blogspot.com/

WCF – The binding X does not have a configured binding named Y

| Monday, April 11, 2011
A few days ago, I was dealing with an issue while writing a simple WCF REST service in .NET 3.5. One of the issues I was running into had to do with the way I had written my app.config file for the WCF service. Basically, I wanted to be able to have a REST service in WCF, so I needed to use a webHttpBinding binding for my service. In a WCF service, there are serviceBehaviors, services, endpoints for services, and bindings. Where things can get a little confusing is in the service endpoint configuration. For instance, say you had the following service defined.

<services>
  <service behaviorconfiguration="serviceBehavior" name="Services.MobileService">
    <endpoint address="" binding="webHttpBinding" bindingconfiguration="serviceBinding" contract="Services.IMobileService">
      <identity>
        <dns value="localhost">
      </dns></identity>
    </endpoint>
    <host>
      <baseaddresses>
        <add baseaddress="http://localhost:9590">
      </add></baseaddresses>
    </host>
  </service>
</services>

In the service, we define the behaviorConfiguration and bindingConfiguration to use. Where things get a little weird is line 5, where we define the binding for the endpoint. At first, I didn’t realize this was the binding type, not name or anything else like that. I had the following binding defined.

Posted via email from Jasper-net

0 comments: