开发者

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

开发者 https://www.devze.com 2023-03-06 13:14 出处:网络
I have followed this tutorial for building my chat application. When I try to add reference of my service I get the following error:

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>


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


BasicHttpBinding is the binding which is used on the default endpoint - the one which is created when no element can be found which matches the service name. The "name" attribute in the element must match the fully-qualified name of the service class, which I guess isn't the case in your scenario.

If you're using C#, the fully qualified name will be the complete namespace + '.' + the class name. If you're using VB, it's possible that the "root namespace" property of the project is prepended to the namespace name. The sure way to find out the name to use is to use a tool such as reflector or ildasm and open the DLL which contains your service class.

0

精彩评论

暂无评论...
验证码 换一张
取 消