基于WCF的基于SSL Rest的Web服务基础认证
问题描述:
我有一个简单的基于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]。”。
我搜索了很多,但到目前为止,我所有的理解和解决这个问题的尝试都是徒劳的。如果我使用匿名身份验证,那么我没有问题,但我需要使用基本身份验证。
任何帮助是极大的赞赏。谢谢。
在IIS管理器中,您是否编辑过网站的绑定以使https可用? –
嗨...你是指使用adsutils.vbs脚本? – Pappy
请参阅我的文章'[WCF:SOAP/REST + SSL +基本身份验证+ IIS](http://vgolovchenko.wordpress.com/2012/05/20/wcf-soaprest-ssl-basic-authentification-iis/) ”。 – vladimir77