2011-10-04 162 views
1

我有一個簡單的基於WCF REST的服務部署(開發課程)使用SSL。我試圖使它與基本的身份驗證一起工作,但坦率地說,它沒有得到它。基於WCF的基於SSL Rest的Web服務基礎認證

基於IIS 6.0 REST - 使用的WebHttpBinding

這裏是我的web.config看起來像......只是相關部分:

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

我已經匿名身份驗證在IIS關閉的WCF服務和基本身份驗證的虛擬目錄已打開。

當我嘗試訪問它說使用https://localhost/ThisTestService/MyTestService.svc,我無法去它。它給出了「無法找到與綁定WebHttpBinding的端點匹配方案http的基地址,註冊的基地址方案是[https]。」。

我搜索了很多,但到目前爲止,我所有的理解和解決這個問題的嘗試都是徒勞的。如果我使用匿名身份驗證,那麼我沒有問題,但我需要使用基本身份驗證。

任何幫助是極大的讚賞。謝謝。

+0

在IIS管理器中,您是否編輯過網站的綁定以使https可用? –

+0

嗨...你是指使用adsutils.vbs腳本? – Pappy

+0

請參閱我的文章'[WCF:SOAP/REST + SSL +基本身份驗證+ IIS](http://vgolovchenko.wordpress.com/2012/05/20/wcf-soaprest-ssl-basic-authentification-iis/) 」。 – vladimir77

回答