簡體   English   中英

在app.config控制台應用程序中配置輪詢雙工

[英]Configuring Polling Duplex in app.config Console App

我在控制台應用程序中配置輪詢雙工綁定時遇到問題。 這是我收到的錯誤:

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中的片段:

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

問題

  • 甚至可以在控制台應用程序中配置輪詢雙工嗎?
  • 如果是這樣,我在做什么錯?

謝謝

據我所知,PollingDuplexHttpBinding不能用作.NET Framework的客戶端組件。

實際上,您知道,擁有一個發布通知的客戶端並不需要雙工功能-可以將其構建為單獨的請求/響應WCF服務端,並通過諸如BasicHttpBinding之類的簡單綁定公開。 對於確實需要通過雙工合同接收異步通知的Windows應用程序或控制台客戶端,請考慮使用WsDualHttpBinding或NetTcpBinding,兩者均提供雙工通信。

盡管在最新版本的.NET Framework中(也許沒有),這可能已更改(請嘗試添加對System.ServiceModel.PollingDuplex.dll的引用)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM