提供的 URI 方案“https”无效;预期的“http”。参数名称:通过

Posted

技术标签:

【中文标题】提供的 URI 方案“https”无效;预期的“http”。参数名称:通过【英文标题】:The provided URI scheme 'https' is invalid; expected 'http'.Parameter name: via 【发布时间】:2012-02-19 02:30:57 【问题描述】:

我在下面的配置中使用了没有“https”的配置。现在 url 更改为 "https"。但我收到 “提供的 URI 方案 'https' 无效;预期为 'http'。参数名称:通过” 调用时出错。

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="ERightsPortBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>          
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="https://dev.company.com/jws/ws/EService?WSDL" binding="basicHttpBinding" bindingConfiguration="ERightsPortBinding" contract="ERights.ERights" name="ERightsPort" />
</client>

如何修复错误?

【问题讨论】:

我最近使用***.com/questions/2435823/… 解决了这个问题。 【参考方案1】:

security 标签的模式更改为Transport 会得到什么?

<security mode="Transport">

我们使用 https 服务,这是我们使用的模式——我们在开发环境中使用None 表示 http。

【讨论】:

这对我有用,但是当我打电话给 eRights.isMember(userName);它说...“找不到 ws.security.company.comisMember 的调度方法” 听起来您可能遇到了另一个问题(这意味着另一个问题)。您可以发布您的合同和实施(缩写版本),以查看是否有人可以看到您的服务合同存在问题。但这似乎与您最初的问题无关。 看来您已经问过另一个问题了。如果这回答了您的问题,则应将其标记为如此。 :) 谢谢大卫,这行得通..你能解释一下为什么这会解决它吗?仍然对这条错误消息的最初含义感到困惑。

以上是关于提供的 URI 方案“https”无效;预期的“http”。参数名称:通过的主要内容,如果未能解决你的问题,请参考以下文章

从服务中获取错误“提供的 uri 方案'https'是无效的预期'http”

提供的 URI 方案“https”无效;调用 Web 服务时预期为“http”

自定义绑定:提供的 URI 方案“https”无效;预期的“http”。参数名称:via

未经授权的客户端身份验证方案“匿名”和 URI 方案“https”无效;预期的“http”

通过 HTTPS 的 NLog LogReceiverService 引发无效的 URI 方案异常

调用 https 网络服务 (C#)