![](/img/trans.png)
[英]Alternative to web.config and app.config files for configuring WCF
[英]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.