WCF自托管服务SSL/传输安全性/基本身份验证不';Don’不要索要证件

WCF自托管服务SSL/传输安全性/基本身份验证不';Don’不要索要证件,wcf,ssl,https,wshttpbinding,self-hosting,Wcf,Ssl,Https,Wshttpbinding,Self Hosting,我已经创建了一个具有HTTPS/SSL、传输安全性和基本身份验证的自托管WCF服务。出于某种原因,当我在浏览器中运行服务时,它从不要求提供凭据。怎么了 服务配置: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" /> </system.web> <system.servi

我已经创建了一个具有HTTPS/SSL、传输安全性和基本身份验证的自托管WCF服务。出于某种原因,当我在浏览器中运行服务时,它从不要求提供凭据。怎么了

服务配置:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WsHttpTest.GreetingServiceBehavior">
          <serviceMetadata httpsGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="Basic"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="WsHttpTest.GreetingServiceBehavior" name="WsHttpTest.GreetingService">
        <host>
          <baseAddresses>
            <add baseAddress="https://localhost:8555/WsHttpTest/Greeting" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="WsHttpTest.IGreetingService" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
</configuration>

只有当您与端点通信=您创建了服务契约中公开的代理和调用操作时,才会使用
wsHttpBinding
的配置。打开服务的帮助页面时,您不会与端点通信

ServiceMetadataBehavior
还提供了两个附加属性
HttpsHelpPageBinding
HttpsHelpPageBindingConfiguration
。也许如果您使用这些属性并为它们配置一些自定义绑定(必须是自定义的,因为它需要
MessageVersion.None
),您将能够强制帮助页也需要身份验证,但我从未尝试过

我将从以下内容开始:

<bindings>
  <cutstomBinding>
    <binding name="helpPage">
      <textMessageEncoding messageVersion="None" />
      <httpsTransport authenticationScheme="Basic" />
    </binding>
  </customBinding>
</bindings>

<bindings>
  <cutstomBinding>
    <binding name="helpPage">
      <textMessageEncoding messageVersion="None" />
      <httpsTransport authenticationScheme="Basic" />
    </binding>
  </customBinding>
</bindings>