2

Using .NET 4 and Silverlight 4 in Visual Studio 2010, I am trying to follow the MSDN guide to build a duplex service for a Silverlight client (http://msdn.microsoft.com/en-us/library/cc645027(v=vs.96).aspx).

Web.config gives warning:

Warning 26 The element 'bindings' has invalid child element 'pollingDuplexHttpBinding'. List of possible elements expected: 'basicHttpBinding, customBinding, msmqIntegrationBinding, netPeerTcpBinding, netMsmqBinding, netNamedPipeBinding, netTcpBinding, wsFederationHttpBinding, ws2007FederationHttpBinding, wsHttpBinding, ws2007HttpBinding, wsDualHttpBinding, netTcpContextBinding, wsHttpContextBinding, basicHttpContextBinding, mexHttpBinding, mexHttpsBinding, mexNamedPipeBinding, mexTcpBinding, webHttpBinding'. C:\DuplexService\DuplexService\Web.config

I am unable to add the Service Reference to the client. I am unable to load the service in WCF Test Client. I have looked for answers in many places. I don't see what the problem is.

The web.config currently looks like this:

<!-- Register the binding extension from the SDK. -->
<extensions>
  <bindingExtensions>
    <add name=
        "pollingDuplexHttpBinding"
        type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </bindingExtensions>
</extensions>

<bindings>
  <!-- Create the polling duplex binding. -->
  <pollingDuplexHttpBinding>
    <binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
             duplexMode="MultipleMessagesPerPoll"
             maxOutputDelay="00:00:07"/>
  </pollingDuplexHttpBinding>
</bindings>

<services>
  <service name="DuplexService.OrderService"
     behaviorConfiguration="DuplexService.OrderServiceBehavior">

    <!-- Service Endpoints -->
    <endpoint
       address=""
       binding="pollingDuplexHttpBinding"
       bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
       contract="DuplexService.IDuplexService">
    </endpoint>
    <endpoint
        address="mex"
        binding="mexHttpBinding"
        contract="IMetadataExchange"/>
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

Kiquenet
  • 13,271
  • 31
  • 133
  • 232
John
  • 21
  • 1
  • 2

2 Answers2

4

I also had this issue. Solved this by adding

C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Server\System.ServiceModel.PollingDuplex.dll

to the References of the WebRole project.

Matt
  • 70,063
  • 26
  • 142
  • 172
Thomas Antony
  • 475
  • 6
  • 16
1

Use this config... it works for me.

<system.serviceModel>
<extensions>
  <bindingElementExtensions>
    <add name="pollingDuplex"
         type="System.ServiceModel.Configuration.PollingDuplexElement, 
         System.ServiceModel.PollingDuplex" />
  </bindingElementExtensions>
</extensions>
<bindings>
  <customBinding>
    <binding name="pollingDuplexBinding">
      <binaryMessageEncoding />
      <pollingDuplex maxPendingSessions="2147483647"   
                     maxPendingMessagesPerSession="2147483647" 
                     />
      <httpTransport />
    </binding>
  </customBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="sb">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
      <serviceThrottling maxConcurrentSessions="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="DataServices" behaviorConfiguration="sb" >
    <endpoint address="" 
              binding="customBinding" 
              bindingConfiguration="pollingDuplexBinding"
              contract="DataServices.IDataService"/>
    <endpoint address="mex" 
              binding="mexHttpBinding" 
              contract="IMetadataExchange"/>
  </service>
</services>
Coumar
  • 11
  • 1