【问题标题】:Using SSL with WP7, WCF service and Azure将 SSL 与 WP7、WCF 服务和 Azure 结合使用
【发布时间】:2012-09-02 08:15:03
【问题描述】:

我正在尝试使用 SSL 证书连接到我的 azure WCF 服务。我看过一些关于更改 web.config 文件中的“绑定”属性的教程,但我遵循的教程导致这是不可能的(据我所知):

http://www.silverlightshow.net/items/Producing-and-Consuming-OData-in-a-Silverlight-and-Windows-Phone-7-application-Part-4.aspx

我的 Azure 数据库中的数据是使用我的 Azure 托管 WCF 服务公开的,目前,连接字符串包含敏感数据。

使用我的 SSL 证书(我最近购买了通配符 SSL 证书)我想从我的 WP7 应用程序连接到我的 Azure 托管 WCF 服务。

基本上我正在寻找一些指导:

  • 如何设置我的 WP7 应用和我的 Azure 托管 WCF 服务之间的 SSL 连接,以便只有应用的用户可以访问该服务?

谢谢!

【问题讨论】:

    标签: wcf windows-phone-7 ssl azure ssl-certificate


    【解决方案1】:

    你需要做一些事情:

    1. 将客户端 (WP7) 和服务器(WCF 服务)都配置为 use the basicHttpBinding with Security mode set to Transport。这将允许您使用 HTTPS 端点。

    <system.serviceModel>    
       <bindings>
         <basicHttpBinding>
           <binding allowCookies="True">
             <security mode="Transport" />
           </binding>
         </basicHttpBinding>
       </bindings>
    </system.serviceModel>  
    
    1. Upload the certificate in your cloud service 通过门户网站。
    2. Web 角色(csdef 和 cscfg)中的Add an HTTPS endpoint referencing the certificate(通过指纹)。
    3. Map a CNAME to your cloudapp address 与您的证书中定义的通配符域匹配。

    【讨论】:

    • 感谢您的回答。由于我的 WCF 服务作为服务引用添加到我的项目中,因此我没有像步骤 1 中的教程那样的“ServiceReference.ClientConfig”文件。我正在使用 oData 和 Linq2Sql 从 web 服务获取数据,所以大概我需要使用不同的安全方法?
    • 您可以自己创建ClientConfig并添加一个不带名称的绑定。在 .NET 4.0 中,没有名称的绑定将应用于所有使用未指定 bindingConfiguration 的绑定的端点。我希望这也适用于 WP7,但我不是 100% 确定。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-26
    • 2013-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-25
    • 2012-02-21
    相关资源
    最近更新 更多