WCF On HTTPS生成“提供的URI方案”https'无效;预期'http'。“ [英] WCF On HTTPS Generates "The provided URI scheme 'https' is invalid; expected 'http'."

查看:443
本文介绍了WCF On HTTPS生成“提供的URI方案”https'无效;预期'http'。“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have been googling everywhere I can possibly find (including here on Stackoverflow) to figure out an error I've got trying to deploy a WCF service to IIS 7.5 on Windows 7 x64 that runs only over SSL with basic HTTP authentication. I've got a site in IIS which has a binding to port 50443 for HTTPS with a self-signed cert. (I can't use the standard port 443, as we plan on deploying this to IIS on a server which is already running Tomcat which is listening on 80 and 443.)

这是web.config:

This is the 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>

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

If I browse to the service endpoint address and enter the basic authentication credentials manually, I get the following exception error message displayed in my browser:


提供的URI方案https无效;预期'http'。

参数名称:context.ListenUriBaseAddress

The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: context.ListenUriBaseAddress

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

This is the same error I got trying to run a WCF client against a similar service, except that it ends with "Parameter name: via" (because the parameter name of the method that shows up in the call stack, "System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(URI via)", is in fact "via").

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

I've tweaked the server and client config files so many times I've lost track, but the web.config file above is my best guess so far--and it doesn't even work from a browser, much less a WCF client.

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

What do I need to do to access a WCF service hosted in IIS 7.5 on a nonstandard SSL port with basic HTTP authentication over HTTPS? Help! (& Thanks!)

推荐答案

尝试将此添加到绑定

<security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
    <message clientCredentialType="Certificate" algorithmSuite="Default" />
</security> 

这篇关于WCF On HTTPS生成“提供的URI方案”https'无效;预期'http'。“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆