我需要在 web.config 中修复哪些内容才能使此 MSDN 示例正常工作?
在 Visual Studio 2010 中使用 .NET 4 和 Silverlight 4,我尝试按照 MSDN 指南为 Silverlight 客户端构建双工服务 (http://msdn.microsoft.com/en-us/library/cc645027(v=vs.96).aspx)。
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 测试客户端中加载该服务。我在很多地方寻找答案。我不明白问题出在哪里。
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" />
Using .NET 4 and Silverlight 4 in Visual Studio 2010, I am trying to follow the MSDN guide to build a duplex service for a Silverlight client (http://msdn.microsoft.com/en-us/library/cc645027(v=vs.96).aspx).
Web.config gives warning:
Warning 26 The element 'bindings' has invalid child element
'pollingDuplexHttpBinding'. List of possible elements expected:
'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
I am unable to add the Service Reference to the client. I am unable to load the service in WCF Test Client. I have looked for answers in many places. I don't see what the problem is.
The web.config currently looks like this:
<!-- 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" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有这个问题。通过添加
到 WebRole 项目的引用解决了这个问题。
I also had this issue. Solved this by adding
to the References of the WebRole project.
使用这个配置...它对我有用。
Use this config... it works for me.