如何为WCF webHttpBinding AJAX Ajax启用服务启用SSL?

时间:2014-03-26 18:38:11

标签: ajax wcf

我有一个WCF webHttpBinding AJAX启用服务,我需要为SSL配置。 SSL已在服务器上打开。我知道如何为basicHttpBinding执行此操作,但不支持webHttpBinding。我的配置是:

<system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="AlphaFrontEndSiteASP.TestsServiceAspNetAjaxBehavior">
          <enableWebScript />
          <webHttp />
        </behavior>
        <behavior name="AlphaFrontEndSiteASP.Services.TestsService">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="MetadataBehavior">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name="AlphaFrontEndSiteASP.Services.TestsService" behaviorConfiguration="MetadataBehavior">
        <endpoint address="" behaviorConfiguration="AlphaFrontEndSiteASP.TestsServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="AlphaFrontEndSiteASP.Services.TestsService" />
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
    </services>
  </system.serviceModel>
</configuration>

1 个答案:

答案 0 :(得分:0)

<bindings>
      <webHttpBinding>
        <binding name="webHttpTransportSecurity">
          <security mode="Transport" />
        </binding>
      </webHttpBinding>