我花了很长时间才弄清楚这一点。我有一个 WCF 服务,我需要向 Silverlight 客户端发送信息,但我需要一个控制台应用程序才能参与其中。谁能给我一个关于我的 Web.Config 应该是什么样子的提示,以指定控制台应用程序可以访问的附加绑定?当我认为我的工作正常时,SL 客户端无法接收任何消息......
这是我当前的 Web.Config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<extensions>
<bindingExtensions>
<add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement,System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="">
<!-- 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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<!-- Create the polling duplex binding. -->
<bindings>
<pollingDuplex>
<binding name="myPollingDuplex"
duplexMode="MultipleMessagesPerPoll">
</binding>
</pollingDuplex>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name ="EdiManager.Web.EdiPubSub">
<endpoint address=""
binding="pollingDuplex"
bindingConfiguration="myPollingDuplex"
contract="EdiManager.Web.EdiPubSub"
/>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
</system.serviceModel>
</configuration>