开发者

Silverlight 4 WCF Duplex Service - How to configure for HTTPS

How do I configure my Silverlight app and duplex WFC service to use HTTPS? Currently evrything works if using HTTP, but as soon as the client hits the site using HTTPS, the callback creation within the service fails. I believe I need to modify my config file, but I can't figure out what it should be set to.

Here is my current config:

<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="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />

      <serviceThrottling maxConcurrentSessions="2147483647" maxConcurrentInstances="2147483647" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
  </serviceBehaviors>
</behaviors>

<bindings>
  <pollingDuplex>
    <binding name="myPollingDuplex" duplexMode="SingleMessagePerPoll" />        
  </pollingDuplex>
</bindings>

<services>
  <service name="UnityEca.Web.Services.SearchPollingService">
    <endpoint address="" binding="pollingDuplex" bindingConfiguration="myPollingDuplex" contract="UnityEca.Web.Services.SearchPollingService" />
    <endpoint ad开发者_开发百科dress="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  multipleSiteBindingsEnabled="true" />

From my Silverlight app, I create the client proxy like so:

SearchPollingServiceClient client = new SearchPollingProxy.SearchPollingServiceClient(
    new PollingDuplexHttpBinding { DuplexMode = PollingDuplexMode.SingleMessagePerPoll },
    new EndpointAddress("../Services/SearchPollingService.svc"));

Thanks...


Have you implemented a clientaccesspolicy file for SSL? See here: http://timheuer.com/blog/archive/2008/10/14/calling-secure-services-with-silverlight-2-ssl-https.aspx

You may also need to add a security element to your ServicesReferences.clientconfig file:

<bindings>
  <pollingDuplex>
    <binding name="myPollingDuplex" duplexMode="SingleMessagePerPoll">
        <security mode="Transport" />
    </binding>
  </pollingDuplex>
</bindings>

See this question for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜