【问题标题】:Unrecognized element 'pollingDuplexHttpBinding' in service reference configuration服务参考配置中无法识别的元素“pollingDuplexHttpBinding”
【发布时间】:2011-12-15 06:54:53
【问题描述】:

我正在使用带有两个端点 basicHttpBinding 和 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" />

【问题讨论】:

    标签: silverlight wcf pollingduplexhttpbinding


    【解决方案1】:

    查看this article
    您需要在客户端配置中添加以下 sn-p:

    <!-- 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>
    

    【讨论】:

    • 我在两边的配置文件中都有这个。我不写 WCF 和客户端的所有配置。这篇文章我红了,单独双工轮询工作,但基本不工作。
    • 如果 basic 意味着 basicHttpBinding 你将需要另一个服务。 Duplexes 和基本服务不兼容,因此您至少需要 2 个服务。
    猜你喜欢
    • 1970-01-01
    • 2021-04-17
    • 1970-01-01
    • 2021-12-26
    • 1970-01-01
    • 1970-01-01
    • 2011-06-26
    • 2011-11-14
    • 1970-01-01
    相关资源
    最近更新 更多