开发者

WCF SSL Rest based web service with basic authetication

I have a simple WCF REST based service deployed (development ofcourse) using SSL. I am trying to make it work with basic authentication but quite frankly am getting nowhere with it.

IIS 6.0 REST 开发者_如何学运维based - Using webHttpBinding

Here is what my web.config looks like ... just the relevant portions:

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ThisTestService.MyTestServiceBehavior"
        name="ThisTestService.MyTestService">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="Secure" behaviorConfiguration="WebBehavior" contract="ThisTestService.IMyTestService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="Secure" contract="IMetadataExchange"></endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ThisTestService.MyTestServiceBehavior">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="WebBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="Secure">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic"/>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>

I have Anonymous authentication turned off in IIS on the virtual directory for the WCF service and Basic authentication is turned on.

When I try to access it say using https://localhost/ThisTestService/MyTestService.svc, I cannot get to it. It gives the "Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].".

I've googled a lot but so far all my attempts to understand and fix the issue have been in vain. If I use anonymous authentication then I have no issues however I need to use basic authentication.

Any help is greatly appreciated. Thanks.


You need to turn on https for the virtual directory in which you are hosting the service. (As explained in the last para of this article: http://msdn.microsoft.com/en-us/library/aa751792.aspx)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜