【发布时间】:2011-09-27 22:24:33
【问题描述】:
我一直在玩 pollingDuplex 示例,这让我发疯了。我正在使用 customBinding 来集成 readerQuotas 元素,但我不断收到错误消息:“合同需要 Duplex,但绑定 'BasicHttpBinding' 不支持它或未正确配置以支持它。” 当我使用 customBinding 时,BasicHttpBinding 来自哪里?我检查了无数示例,我的配置文件与他们所拥有的匹配,但它不起作用。谁能帮我这个 ? 谢谢。
<configuration>
<system.serviceModel>
<extensions>
<bindingElementExtensions>
<add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/>
</bindingElementExtensions>
</extensions>
<bindings>
<customBinding>
<binding name="DBNotification" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<httpsTransport maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"/>
<pollingDuplex duplexMode="MultipleMessagesPerPoll" maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647"/>
<binaryMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binaryMessageEncoding>
</binding>
</customBinding>
</bindings>
<services>
<service name="AdminWebService" behaviorConfiguration="DBNotificationServiceBehavior">
<endpoint address="adminservice" binding="customBinding" bindingConfiguration="DBNotification" contract="AdminWebService.IAdminWebService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DBNotificationServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentSessions="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
【问题讨论】:
-
我不知道是不是这种情况,但是您可以尝试在自定义绑定中更改元素的顺序,以便传输是最后一个(即
<pollingDuplex/>、@987654323 @ 然后<httpsTransport/>)?当您使用代码创建自定义绑定时,IIRC 会强制执行此顺序。 -
不,同样的事情。就好像它在某个地方检查另一个宇宙中的另一个 web.config 文件。
标签: wcf