【问题标题】:Configuring Polling Duplex in app.config Console App在 app.config 控制台应用程序中配置轮询双工
【发布时间】:2012-04-26 23:39:07
【问题描述】:

我在控制台应用程序中配置轮询双工绑定时遇到问题。这是我收到的错误:

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.

另外,这是我的 app.config 中的一个 sn-p:

    <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>

问题

  • 甚至可以在控制台应用程序中配置轮询双工吗?
  • 如果是这样,我做错了什么?

谢谢

【问题讨论】:

    标签: wcf app-config console-application pollingduplexhttpbinding


    【解决方案1】:

    据我所知,PollingDuplexHttpBinding 不能作为 .NET Framework 的客户端组件使用。

    实际上,正如您所知,拥有一个发布通知的客户端不需要双工功能——它可以构建为一个单独的请求/响应 WCF 服务端,通过像 BasicHttpBinding 这样的简单绑定公开。对于确实需要通过双工合同接收异步通知的 Windows 应用程序或控制台客户端,请考虑使用 WsDualHttpBinding 或 NetTcpBinding,它们都提供双工通信。

    这可能在 .NET Framework 的最新版本中发生了变化(也许没有)——如果可用,请尝试添加对 System.ServiceModel.PollingDuplex.dll 的引用。

    【讨论】:

      猜你喜欢
      • 2011-11-28
      • 1970-01-01
      • 2012-04-21
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 1970-01-01
      • 2017-11-16
      • 2018-09-12
      相关资源
      最近更新 更多