在Visual Studio 2010中使用.NET 4和Silverlight 4時,我試圖按照MSDN指南爲Silverlight客戶端(http://msdn.microsoft.com/en-us/library/cc645027(v=vs.96).aspx)構建雙工服務。我需要在web.config中修復以獲取此MSDN示例的工作方式?
Web.config中給出了警告:
警告26元 '綁定' 具有無效的子元素 'pollingDuplexHttpBinding'。可能元素的列表預期: 「basicHttpBinding的,customBinding,msmqIntegrationBinding, netPeerTcpBinding,netMsmqBinding,netNamedPipeBinding,NetTcpBinding的, wsFederationHttpBinding,ws2007FederationHttpBinding,的wsHttpBinding, ws2007HttpBinding,wsDualHttpBinding,netTcpContextBinding, wsHttpContextBinding,basicHttpContextBinding,mexHttpBinding, mexHttpsBinding,mexNamedPipeBinding,mexTcpBinding , webHttpBinding'。 C:\ DuplexService \ DuplexService \ Web.config
我無法將服務引用添加到客戶端。我無法在WCF Test Client中加載服務。我在很多地方都找過答案。我看不出有什麼問題。
的Web.config目前看起來是這樣的:
<!-- 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>
</extensions>
<bindings>
<!-- Create the polling duplex binding. -->
<pollingDuplexHttpBinding>
<binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
duplexMode="MultipleMessagesPerPoll"
maxOutputDelay="00:00:07"/>
</pollingDuplexHttpBinding>
</bindings>
<services>
<service name="DuplexService.OrderService"
behaviorConfiguration="DuplexService.OrderServiceBehavior">
<!-- Service Endpoints -->
<endpoint
address=""
binding="pollingDuplexHttpBinding"
bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
contract="DuplexService.IDuplexService">
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />