简体   繁体   中英

Configuring Polling Duplex in app.config Console App

I am having an issue configuring polling duplex binding in my console application. This is the error I am receiving:

Configuration binding extension 'system.serviceModel/bindings/pollingDuplexHttpBinding' could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that it is spelled correctly.

Also, here is a snippet from my app.config:

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

    <services>
      <service behaviorConfiguration="PositionBehaviour" name="RabbitMQSub.PositionUpdates">
        <endpoint address="positionsDUPLEX" binding="pollingDuplexHttpBinding" contract="RabbitMQSub.IPositionUpdates">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>

        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/RabbitMQSub/PositionsDUPLEX" />
          </baseAddresses>
        </host>

      </service>
    </services>

<behaviors>
  <serviceBehaviors>
    <behavior name="PositionBehaviour">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      <serviceTimeouts transactionTimeout="10:00:00"/>
      <serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" maxConcurrentInstances="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

  • Is it even possible to configure polling duplex in a console app?
  • If so, what am I doing wrong?

Thanks

As far as I know, PollingDuplexHttpBinding is not available as a client side component of .NET Framework.

Actually, just so you know, having a client that publishes notifications does NOT require duplex capability -- it can be built as a separate request/response WCF service end exposed over a simple binding like BasicHttpBinding. For Windows application or console clients that really need to receive asynchronous notifiations over duplex contracts, consider using WsDualHttpBinding or NetTcpBinding, both of which offer duplex communication.

It's possible this has changed though in the very latest release of .NET Framework (maybe not) -- try adding a reference to System.ServiceModel.PollingDuplex.dll if it's available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM