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

我有我的 有效证书已上传 成功地 (使用 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>

不幸的是,调试这个并获取更多信息非常困难,因为我无法像在实时服务器上使用的那样远程单步调试任何配置,因为 绑定标签有问题 正在调试(但不是实时)。

感谢您的帮助和兴趣!

有帮助吗?

解决方案

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

仍然无法在调试中工作(安全异常),但我会忍受这一点,直到下一个版本。

这是有效的配置:

  <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 启用某种日志记录,但我会进一步浏览这个很棒的网站,我相信我会找到答案。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top