简体   繁体   English

在app.config控制台应用程序中配置轮询双工

[英]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: 另外,这是我的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>

Questions 问题

  • 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. 据我所知,PollingDuplexHttpBinding不能用作.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. 实际上,您知道,拥有一个发布通知的客户端并不需要双工功能-可以将其构建为单独的请求/响应WCF服务端,并通过诸如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. 对于确实需要通过双工合同接收异步通知的Windows应用程序或控制台客户端,请考虑使用WsDualHttpBinding或NetTcpBinding,两者均提供双工通信。

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. 尽管在最新版本的.NET Framework中(也许没有),这可能已更改(请尝试添加对System.ServiceModel.PollingDuplex.dll的引用)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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