WCF在HTTPS上生成"提供的URI方案'https'无效;预期'http'."

ALE*_*sos 2 ssl https wcf iis-7.5

我一直在google搜索我可能找到的任何地方(包括在这里的Stackoverflow),以找出我试图将WCF服务部署到Windows 7 x64上的IIS 7.5上的错误,该服务仅通过基本HTTP身份验证的SSL运行.我在IIS中有一个站点,它具有绑定到端口50443的HTTPS以及自签名证书.(我不能使用标准端口443,因为我们计划在已经运行Tomcat的服务器上将其部署到IIS,该服务器正在监听80和443.)

这是web.config:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="SSLBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="HelloWorldWcf.HelloWorldWcfService">
        <endpoint name="HelloWorldWcf.HelloWorldWcfService" 
                  address="https://mylaptop:50443/HelloWorld/Service1.svc" 
                  binding="basicHttpBinding" 
                  bindingConfiguration="SSLBinding" 
                  contract="HelloWorldWcf.IHelloWorldWcfService"/>
        <endpoint address="https://mylaptop:50443/HelloWorld/Service1.svc/mex" 
                  binding="mexHttpsBinding" 
                  contract="IMetadataExchange"/>
      </service>
    </services>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

如果我浏览到服务端点地址并手动输入基本身份验证凭据,则会在浏览器中显示以下异常错误消息:

提供的URI方案"https"无效; 预计'http'.
参数名称:context.ListenUriBaseAddress

这是我尝试针对类似服务运行WCF客户端时出现的相同错误,除了它以"参数名称:via"结尾(因为调用堆栈中显示的方法的参数名称为"System.ServiceModel"). Channels.TransportChannelFactory`1.ValidateScheme(URI via)",实际上是"via").

我已经调整了服务器和客户端配置文件很多次我失去了轨道,但上面的web.config文件是我迄今为止最好的猜测 - 它甚至不能在浏览器中运行,更不用说WCF客户端了.

通过HTTPS进行基本HTTP身份验证,在非标准SSL端口上访问IIS 7.5中托管的WCF服务需要做什么?救命!(& 谢谢!)

bur*_*ION 5

尝试将此添加到绑定

<security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
    <message clientCredentialType="Certificate" algorithmSuite="Default" />
</security> 
Run Code Online (Sandbox Code Playgroud)