服务引用配置中无法识别的元素“pollingDuplexHttpBinding”

时间:2011-12-15 06:54:53

标签: silverlight wcf pollingduplexhttpbinding

我正在使用带有两个端点basic WttpBinding和pollingDuplexHttpBinding的WCF。 在Silverlight 4中使用WCF。 如果我一个人基本...并且投票......它运作良好。但如果我在一个服务和一个silverlight项目中同时使用,我在客户端收到了消息:

“服务引用配置中无法识别的元素'pollingDuplexHttpBinding'。请注意,Silverlight中只提供了Windows Communication Foundation配置功能的一部分。”

WFC正确引用了silverlight项目,但无效。 这是WCF的web.config:

 <services>
      <service behaviorConfiguration="Service1Behavior" name="Service1">
        <endpoint
          address=""
          binding="basicHttpBinding"
          bindingConfiguration="LargeBuffer"
          contract="IService1"
          listenUri="http://localhost:7007/Service1.svc">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint
          address=""
          binding="pollingDuplexHttpBinding"
          bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
          contract="ILongService1"
          listenUri="http://localhost:7007/Service1.svc/LongService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

这是客户端的配置:

<endpoint address="http://localhost:7007/ServiceWebTDM.svc/LongService"
      binding="pollingDuplexHttpBinding" bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
      contract="GXWebTDM.Web.ILongServiceWebTDM" name="LongServiceWebTDMDev" />

          <endpoint address="http://localhost:7007/ServiceWebTDM.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IServiceWebTDM1" contract="GXWebTDMService.IServiceWebTDM"
                name="ServiceWebTDMDev" />

1 个答案:

答案 0 :(得分:0)

查看this article
您需要在客户端配置中添加以下代码段:

<!-- Register the binding extension from the SDK. -->
<extensions>
  <bindingExtensions>
    <add name=
        "pollingDuplexHttpBinding"
        type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </bindingExtensions>