使用SSL的Azure云服务的自定义域

时间:2012-12-13 16:13:28

标签: ssl service azure

我正在尝试使用带有自定义域的https公开Azure云服务,但是我收到错误消息:“无法激活所请求的服务'https://mydomain.net/myservice.svc'。请参阅服务器的诊断跟踪日志以获取更多信息。“

关于自定义域:我已按照https://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns/#header-1中的步骤进行第二个选项“A记录”:在godaddy的区域文件管理器中,我为“@”主机配置了A记录“指向“myservice的”公共虚拟IP地址“(在Azure门户中找到)。在我看来,我得到“服务无法激活”的事实意味着A记录正在运作,但我不确定。

关于https:我已按照http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2011/06/how-to-get-and-install-ssl-certificate.html的步骤进行操作。简而言之:我使用我的开发机器中的CSR从migomain.net购买了一个来自godaddy的证书,使用友好名称mydomain.net在我的开发机器上完成了CSR,将其导出到mydomain.net.pfx,使用该文件,上传Azure中我的云服务的证书,并使用证书在VS中配置我的WebRole,并将Web角色项目发布到Azure。

在客户端(WP7):

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpsBinding_IMyInterface" 
      maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647">
      <security mode="Transport" />
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint name="BasicHttpsBinding_IMyInterface"
    address="https://mydomain.net/myservice.svc" 
    contract="MyService.IMyInterface"       
    binding="basicHttpBinding"
    bindingConfiguration="BasicHttpsBinding_IMyInterface" />
</client>

注意:我没有使用CName,因为我的证书不适用于子域而且它不是通配符。

从我的搜索中,我得到的印象是这对其他人有用,我无法弄清楚我在做什么不同。

1 个答案:

答案 0 :(得分:0)

是的 - 您需要在服务器配置中指定匹配的端点。以下是使用HTTP传输安全性(来自http://msdn.microsoft.com/en-us/library/hh556232.aspx)的WCF服务的web.config文件的完整示例:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="MySecureWCFService.Service1">
        <endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="secureHttpBinding"
                  contract="MySecureWCFService.IService1"/>

        <endpoint address="mex"
                  binding="mexHttpsBinding"
                  contract="IMetadataExchange" />
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="secureHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpsGetEnabled="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" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>
相关问题