Silverlight 4 WCF 双工服务 - 如何配置 HTTPS

发布于 2024-10-16 08:32:07 字数 1988 浏览 3 评论 0原文

如何配置我的 Silverlight 应用程序和双工 WFC 服务以使用 HTTPS?目前,如果使用 HTTP,一切都可以工作,但一旦客户端使用 HTTPS 访问站点,服务内的回调创建就会失败。我相信我需要修改我的配置文件,但我不知道它应该设置为什么。

这是我当前的配置:

<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 address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

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

从我的 Silverlight 应用程序中,我创建客户端代理,如下所示:

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

谢谢...

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 address="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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一袭水袖舞倾城 2024-10-23 08:32:07

您是否实施了 SSL 的客户端访问策略文件?请参阅此处:http://timheuer.com/blog/archive/2008/10/14/calling-secure-services-with-silverlight-2-ssl-https.aspx

您可能还需要添加安全元素您的 ServicesReferences.clientconfig 文件:

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

请参阅此问题< /a> 了解更多详细信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文