Wcf – Binding wcf with asp.net

asp.netwcfwcf-binding

I'm trying to bind an asp.net page to wcf service hosted by another website,

the web.config file for the client has the code:

<endpoint address="http://localhost:1670/webhost/CustomersService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_ICustomersService" contract="CustomersService.ICustomersService" name="BasicHttpBinding_ICustomersService"/>
</client>

the web.config file for the service has the code:

<endpoint address="" binding="wsHttpBinding" contract="CustomerServiceLibrary1.ICustomersService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>

and the error is :

Error 1 Reference.svcmap: The binding at system.serviceModel/bindings/wsHttpBinding does not have a configured binding named 'wsHttpBinding_ICustomersService'. This is an invalid value for bindingConfiguration. (C:\Users\Lara\Documents\Visual Studio 2010\Projects\CustomerServiceDemo\WebClient\web.config line 25) App_WebReferences/CustomersService/.

Best Answer

The following part of your client configuration bindingConfiguration="wsHttpBinding_ICustomersService"

tells that it should use a binding configuration with the name "wsHttpBinding_ICustomersService" do you have a binding configuration in your client web.config with that name?

The following article explains WCF and bindings http://msdn.microsoft.com/en-us/magazine/cc163394.aspx

But this part should be what your looking for

<configuration>
  <system.serviceModel>
    <services>
      <service name=”ChatService”>
        <endpoint address=”http://localhost:8080/chat” 
          binding=”basicHttpBinding” 
          bindingConfiguration=”basicConfig” 
          contract=”ChatLibrary.IChat” />
        ...
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name=”basicConfig” messageEncoding=”Mtom”>
          <security mode=”Transport”/>
        </binding>
      </basicHttpBinding>
      ...
    </bindings>
  </system.serviceModel>
</configuration>

Notice the "bindings" section

Related Topic