C#中的REST端点上的SSL?

Doo*_*ght 0 c# rest ssl endpoint

我为我的SOAP端点工作了SSL.

但是一旦我启用了我的REST端点,它就会抛出一个拟合:

Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].
Run Code Online (Sandbox Code Playgroud)

我的app.config:

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="IIncreasedBufferSize" maxBufferSize="1024000"
          maxReceivedMessageSize="1024000">
          <readerQuotas maxArrayLength="1024000" />

          <security mode ="Transport">
            <transport clientCredentialType= "None" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="WCFBehaviourSSL"
        name="IWCF.IService">
        <endpoint name="soap" address="soap" binding="basicHttpBinding" bindingConfiguration="IIncreasedBufferSize"
          contract="IWCF.IServices">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint name="rest"
                  address="rest"
                  binding="webHttpBinding"
                  contract="IWCF.IServices"
                  behaviorConfiguration="REST" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary2/Service1/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="REST">
          <webHttp/>
        </behavior>
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior name="WCFBehaviourSSL">
          <serviceMetadata httpGetEnabled="False" httpsGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>

      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

我发现了这个问题:基于SSL的REST WCF服务 但是请放心,所提供的答案都没有用.

我有证书,它使用SOAP端点与SSL一起工作.(当休息终点被注释掉时).

Doo*_*ght 5

我错过了使用传输安全性的WebHTTPBinding:

  <webHttpBinding>
    <binding name ="REST SSL">
      <security mode ="Transport">
        <transport clientCredentialType= "None" />
      </security>
    </binding>                
  </webHttpBinding>
Run Code Online (Sandbox Code Playgroud)

...

    <endpoint name="rest"
              address="rest"
              binding="webHttpBinding"
              contract="IWCF.IServices"
              behaviorConfiguration="REST" 
              bindingConfiguration="REST SSL"/> 
Run Code Online (Sandbox Code Playgroud)