wcfsilverlight-4.0bindingc#-4.0duplex

WCF Polling Duplex Binding and Non-Silverlight Clients


I'm having a heck of a time figuring this out. I have a WCF service that I need to puch information to Silverlight client, but I need a console application to also be able to participate in this. Could anyone give me a hint on to what my Web.Config should look like to specify an additional binding that the console app could access? When I think I get things working the SL clients are unable to receive any messages...

Here is my current Web.Config:

<?xml version="1.0"?>

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

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

    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <!-- 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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <!-- Create the polling duplex binding. -->
    <bindings>
      <pollingDuplex>
        <binding name="myPollingDuplex"
                 duplexMode="MultipleMessagesPerPoll">
        </binding>
      </pollingDuplex>
    </bindings>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name ="EdiManager.Web.EdiPubSub">
        <endpoint address=""
                  binding="pollingDuplex"
                  bindingConfiguration="myPollingDuplex"
                  contract="EdiManager.Web.EdiPubSub"
                  />
        <endpoint address="mex" 
                  binding="mexHttpBinding"
                  contract="IMetadataExchange" >
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
      </service>
    </services>
    </system.serviceModel>
</configuration>

Solution

  • If you don't need full duplex just use wsHttpBinding instead of mex (or provide more info what would you like to achieve).