c# - 提供的 URI 方案 'https' 无效;预计 'http' 。参数名称 : via

标签 c# wcf https

我正在尝试通过 basicHttpBinding 创建 WCF 服务以通过 https 使用。这是我的 web.config:

<!-- language: xml -->
<service behaviorConfiguration="MyServices.PingResultServiceBehavior"
         name="MyServices.PingResultService">
    <endpoint address="" 
              binding="basicHttpBinding" 
              bindingConfiguration="defaultBasicHttpBinding"
              contract="MyServices.IPingResultService">
        <identity>
            <dns value="localhost" />
        </identity>
    </endpoint>
    <endpoint address="mex" 
              binding="mexHttpBinding" 
              contract="IMetadataExchange" />
</service>
...
<bindings>
  <basicHttpBinding>
    <binding name="defaultBasicHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
...
<behaviors>
  <serviceBehaviors>
    <behavior name="MyServices.UpdateServiceBehavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

我正在使用能够正确检索所有元数据的 WCFStorm 进行连接,但是当我调用实际方法时,我得到:

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

最佳答案

尝试在您的 app.config 中添加消息凭据,例如:

<bindings> 
<basicHttpBinding> 
<binding name="defaultBasicHttpBinding"> 
  <security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
    <message clientCredentialType="Certificate" algorithmSuite="Default" />
  </security> 
</binding> 
</basicHttpBinding> 
</bindings> 

关于c# - 提供的 URI 方案 'https' 无效;预计 'http' 。参数名称 : via,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2435823/

相关文章:

wcf - 用于非 dot.NET 客户端的 WCF 中的 REST

c# - 事务对象与连接对象不关联 - OracleClient

javascript - 如何找到哪个元素破坏了网页上的 HTTPS?

python - urllib2:读取 https url 失败

java - 代理仅忽略 httpS 请求的身份验证 header

c# - 如何创建 dpi 感知 wpf 应用程序?

c# - (可选)将结构传递给 C# 中的自定义函数

c# - 在一个字符串方法中修剪和填充

c# - Signalr - 无法读取服务器上的查询字符串

c# - WCF从客户端发送int[]到服务器