2011-12-15 58 views
0

我使用帶有兩個端點basicHttpBinding和pollingDuplexHttpBinding的WCF。 在Silverlight 4中消費WCF。 如果我有單獨的基本..和投票..它的效果很好。但是,如果我在一個服務和一個silverlight項目中使用了這兩個項目,我在客戶端獲得了以下消息:服務參考配置中無法識別的元素'pollingDuplexHttpBinding'

「服務參考配置中無法識別的元素」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" /> 

回答

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> 

+0

我有t他在配置文件的兩邊。我不寫所有配置的WCF和客戶端。文章我紅色和獨自雙工輪詢工作,但與基本不工作。 – Musketyr 2011-12-15 09:03:04