我一直在玩一个让我疯狂的pollingDuplex示例。我正在使用customBinding来集成readerQuotas元素并且我不断收到错误:“Contract需要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>
答案 0 :(得分:0)
httpGetEnabled="true"
是否有可能暗示使用BasicHttpBinding
?你真的需要这个功能吗?如果你评论这一行,错误会消失吗?
答案 1 :(得分:0)
您可能遇到了“简化配置”问题 - 详见http://blogs.msdn.com/b/endpoint/archive/2009/11/09/common-user-mistake-in-net-4-mistyping-the-service-configuration-name.aspx。 <service>
元素中的“name”属性必须是服务的完全限定名称。由于您的界面为AdminWebService.IAdminWebService
,因此您的服务名称AdminWebService.AdminWebService
不是?如果是这样,修复name属性应解决问题。