我使用 SSL 部署了一个简单的基于 WCF REST 的服务(当然是开发)。我正在尝试使其与基本身份验证一起使用,但坦率地说,它无济于事。
基于 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]。”。
我用谷歌搜索了很多,但到目前为止,我所有试图理解和解决这个问题的尝试都是徒劳的。如果我使用匿名身份验证,那么我没有问题,但是我需要使用基本身份验证。
任何帮助是极大的赞赏。谢谢。