【问题标题】:SSL On REST Endpoint in C#?C# 中 REST 端点上的 SSL?
【发布时间】:2011-10-06 10:49:34
【问题描述】:

我的 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].

我的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 一起工作。 (当休息端点被注释掉时)。

【问题讨论】:

    标签: c# rest ssl endpoint


    【解决方案1】:

    我缺少一个使用传输安全性的 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"/> 
    

    【讨论】:

      猜你喜欢
      • 2016-05-14
      • 2016-08-13
      • 2019-06-27
      • 2019-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多