【问题标题】:What are the steps to setup SSL to work with WCF on Azure?设置 SSL 以在 Azure 上使用 WCF 的步骤是什么?
【发布时间】:2010-10-10 21:55:30
【问题描述】:

请发布您为设置 SSL 以在 Azure 上使用 WCF 所采取的步骤。

我的 valid certificate uploaded 成功 (using cspack) 并与站点的其余部分一起工作,但在添加它之后,我以前工作的 WCF 服务停止工作。 (我得到的只是返回给 Silverlight 的 404 错误,这不是很有帮助。投票给提出更好日志记录的人,我也可以这样做以帮助诊断问题!)

我在这个配置上尝试了很多变体:

<system.serviceModel>
     <!--start added for SSL--> 
    <bindings>
      <basicHttpBinding>
        <binding name="SecureBasicHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"  />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
     <!--end added for SSL--> 
    <behaviors>
      <!--start added for SSL--> 
      <endpointBehaviors>
        <behavior name="DisableServiceCertificateValidation">
          <clientCredentials>
            <serviceCertificate>
              <authentication certificateValidationMode="None"
                              revocationMode="NoCheck" />
            </serviceCertificate>
          </clientCredentials>
        </behavior>
      </endpointBehaviors>
      <!--start added for SSL--> 
      <serviceBehaviors>
        <behavior name="Silverheat.Cloud_WebRole.API.DataServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <!-- certificate checking removed --> 
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
      <service behaviorConfiguration="Silverheat.Cloud_WebRole.API.DataServiceBehavior"
          name="Silverheat.Cloud_WebRole.API.DataService">
        <!--<endpoint address="" binding="basicHttpBinding" contract="Silverheat.Cloud_WebRole.API.DataService" />-->
        <endpoint bindingConfiguration="SecureBasicHttpBinding"
                  behaviorConfiguration="DisableServiceCertificateValidation"
                  address="" binding="basicHttpBinding"
                  contract="Silverheat.Cloud_WebRole.API.DataService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>

不幸的是,调试这个并获取更多信息真的很难,因为我无法像在实时服务器上使用的那样远程调试和调试任何配置,因为bindings tag has problems 正在调试(但不是实时)。

感谢您的帮助和关注!

【问题讨论】:

    标签: wcf ssl azure


    【解决方案1】:

    哇!它还活着!它的工作!

    在调试中仍然无法工作 (security exception),但我会在下一个版本之前使用它。

    这是有效的配置:

      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="SecureBasicHttpBinding">
              <security mode="Transport">
                <transport clientCredentialType="None"  />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior name="Silverheat.Cloud_WebRole.API.DataServiceBehavior">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
          <service behaviorConfiguration="Silverheat.Cloud_WebRole.API.DataServiceBehavior"
              name="Silverheat.Cloud_WebRole.API.DataService">
            <endpoint bindingConfiguration="SecureBasicHttpBinding"
              address="" binding="basicHttpBinding"
              contract="Silverheat.Cloud_WebRole.API.DataService" />
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
          </service>
        </services>
      </system.serviceModel>
    

    (我认为是“mexHttpsBinding”让它最终工作,虽然我不完全理解为什么它已经配置后需要元数据,回到我猜的书)

    我仍然想知道如何为 WCF 启用某种日志记录,但我会多浏览一下这个很棒的网站,我相信我会找到答案。

    【讨论】:

      猜你喜欢
      • 2013-04-19
      • 2020-04-16
      • 2013-12-25
      • 1970-01-01
      • 1970-01-01
      • 2021-09-30
      • 2014-10-02
      • 2020-05-07
      • 2017-11-22
      相关资源
      最近更新 更多