2011-10-06 105 views
0

我的SSL爲我的SOAP端點工作。C#中REST端點上的SSL?

但只要我讓我的REST端點,它拋出一個適合:

Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https]. 

的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> 

我發現這個問題:REST WCF Service Over SSL 不過放心,沒有提供的答案是有用的。

我有證書,它使用SOAP端點與SSL一起工作。 (當休息端點被註釋掉時)。

回答

5

我缺少的WebHttpBinding,使用傳輸安全:

<webHttpBinding> 
    <binding name ="REST SSL"> 
     <security mode ="Transport"> 
     <transport clientCredentialType= "None" /> 
     </security> 
    </binding>     
    </webHttpBinding> 

。 。 。

<endpoint name="rest" 
       address="rest" 
       binding="webHttpBinding" 
       contract="IWCF.IServices" 
       behaviorConfiguration="REST" 
       bindingConfiguration="REST SSL"/>