Search code examples
silverlightwcfriawcf-ria-servicesduplex

Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it


I have followed this tutorial for building my chat application. When I try to add reference of my service I get the following error:

Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.

My web.config is as follows:

<extensions>
  <bindingExtensions>
    <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </bindingExtensions>
</extensions>

<bindings>      
  <pollingDuplex>
    <binding name="chatPollingDuplex" duplexMode="MultipleMessagesPerPoll"/>
  </pollingDuplex>
</bindings>    

<services>      
  <service name="PrototypeSite.ChatService">        
    <endpoint address="" binding="pollingDuplex" bindingConfiguration="chatPollingDuplex" contract="PrototypeSite.ChatService" />
    <endpoint address="mex" binding="wsDualHttpBinding" contract="IMetadataExchange"/>
  </service>      
</services>

Solution

  • When I'd got this error, It made a lot of pain for me, but the solution was quite simple - double check service name in your web.config.

    wherever you have service in the same web assembly or not, you have to include full TypeName of your service