WCF/WF - Contract requires Duplex, but Binding 'WSHttpBinding' doesn't support

Asked By Debalaxmi Hota on 16-Dec-11 01:53 AM


I am trying to run the Chat application using WCF and WPF. But when I run the service I am getting the error
"Contract requires Duplex, but Binding 'WSHttpBinding' doesn't support it or isn't configured properly to support it"

Can  please guide me how to set my web.config file so that I can able to run the program. How to set the

<


appSettings>

<


add key="addr" value="net.tcp://localhost:4445/WcfChatter/ChatService.svc"/>

</


appSettings>

I have put the value "net.tcp://localhost:4445/WcfChatter/ChatService.svc"  as I got the url from my browser when I run the service i.e. http://localhost:4445/WcfChatter/ChatService.svc
please reply me as soon as possible.

Below is my web.config file.

<?





xml version="1.0"?>

<



configuration>

<



appSettings>

<



add key="addr" value="net.tcp://localhost:4445/WcfChatter/ChatService.svc"/>

</



appSettings>

<



system.serviceModel>

<



services>


<





service behaviorConfiguration="MyBehavior"




name="WcfChatterService.ChatService">

<



endpoint address="" binding="wsHttpBinding" contract="WcfChatter.IChat">

<



identity>

<



dns value="localhost" />

</



identity>

</



endpoint>

<



endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

</



service>


<!--



<service name="ChatService" behaviorConfiguration="MyBehavior">

<endpoint address="" binding="netTcpBinding" bindingConfiguration="DuplexBinding" contract="IChat"/>






--><!--<host>

<baseAddresses>

<add baseAddress="net.tcp//localhost:4445/WcfChatter/"/>

</baseAddresses>

</host>





--><!--

</service>



-->

</



services>

<



behaviors>

<



serviceBehaviors>

<



behavior name="MyBehavior">

<



serviceThrottling maxConcurrentSessions="10000"/>

</



behavior>

</



serviceBehaviors>

</



behaviors>

<



bindings>

<



customBinding>

<



binding name="customReliableHttpBinding">

<



reliableSession ordered="true" />

<



textMessageEncoding messageVersion="Default" />

<



httpTransport />

</



binding>

</



customBinding>

 

<



netTcpBinding>

<



binding name="DuplexBinding" sendTimeout="00:00:01">

<



reliableSession enabled="true"/>

<



security mode="None"/>

</



binding>

</



netTcpBinding>

</



bindings>

<



protocolMapping> <add scheme="http" binding="wsHttpBinding"/> </protocolMapping>

</



system.serviceModel>

<



system.web>

<



compilation debug="true"/></system.web></configuration>







Jitendra Faye replied to Debalaxmi Hota on 16-Dec-11 02:02 AM


If you are using wcf 4.0 then open web.config/app.config and add following tag inside
<system.serviceModel>
tag.


<protocolMapping> <add scheme="http" binding="wsHttpBinding"/> </protocolMapping>
Riley K replied to Debalaxmi Hota on 16-Dec-11 02:57 AM



It looks like you didn’t started Host before you start client.

 

I think you downloaded this app from code project, follow these steps to get it worked

.

1.     After opening the solution. Set Start up project as WPF Host and  Start without debugging(ctrl+f5)

2.     Click on start button in Chat Service Host

3.     Now set WPF Client as start up project  and  Start without debugging(ctrl+f5)

4.     Set ServiceIP as localhost and click on Connect


Regards