简体   繁体   English

提供的 URI 方案“https”无效; 预期的“http”,即使在指定之后<httpstransport />

[英]The provided URI scheme 'https' is invalid; expected 'http', Even after specifying <httpsTransport/>

I did a lot of searching and nothing seems to work.我做了很多搜索,但似乎没有任何效果。 I have done a custom binding for my Https service.我已经为我的 Https 服务完成了自定义绑定。 which looks like this.看起来像这样。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="Time.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </sectionGroup>
  </configSections>

  <applicationSettings>
    <Time.Properties.Settings>
      <setting name="Time_SupervisorSinkTime_TimeService" serializeAs="String">
       <value>http://localhost:8080/Time/</value>
      </setting>
    </Time.Properties.Settings>
  </applicationSettings>

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IDataSink" closeTimeout="00:00:10" openTimeout="00:00:10" receiveTimeout="00:00:10" sendTimeout="00:00:10" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        </binding>
  <binding name="SslBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="Certificate" algorithmSuite="Default" />
          </security>
        </binding>

        <binding name="EBinding" allowCookies="true"
                 maxReceivedMessageSize="20000000" 
                 maxBufferSize="20000000"
                 maxBufferPoolSize="20000000">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="200000000"
                 maxStringContentLength="200000000"/>
        </binding>  

      </basicHttpBinding>
<customBinding>
  <binding name="customBasicHttpBinding">
    <security authenticationMode="UserNameOverTransport"  enableUnsecuredResponse="true"/>
    <textMessageEncoding messageVersion="Soap11" />
    <httpsTransport />
  </binding>
   <binding name="EBICustom">
   <security authenticationMode="UserNameOverTransport"  enableUnsecuredResponse="true"/>
    <textMessageEncoding messageVersion="Soap12" />
    <httpsTransport maxBufferSize="2097152" maxReceivedMessageSize="1073741824" transferMode="Streamed" />
  </binding>
</customBinding>      
    </bindings>
    <client>
      <endpoint bindingConfiguration="BasicHttpBinding" address="http:///" binding="basicHttpBinding" contract="" name=""/>
     <endpoint bindingConfiguration="EBICustom" address="https://.." binding="customBinding" contract="EBIContract" name="EBIPort" /> 
    <endpoint bindingConfiguration="EBinding" address="http://.." binding="basicHttpBinding" contract="EcontractSEI" name="EService" />
    <endpoint bindingConfiguration="customBasicHttpBinding" address="https://.." binding="customBinding" contract="contractSEI" name="someservice" />

    </client>
    <behaviors>
      <endpointBehaviors>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

  <appSettings>
    <add key="interfaces" />
    <add key="startup" />
  </appSettings>
</configuration>

and also on the client (on the code ) I have done a custom binding.并且在客户端(在代码上)我已经完成了自定义绑定。 but for some reason it gives me the error " provided URI scheme 'https' is invalid; expected 'http' "但由于某种原因,它给了我错误“提供的 URI 方案 'https' 无效;预期的 'http'

the same custom binding work perfectly for customBasicHttpBinding but not for EBICustom .相同的自定义绑定适用于customBasicHttpBinding但不适用于EBICustom

if someone could help me point on what is wrong where, it would really be helpful.如果有人可以帮助我指出哪里出了问题,那真的很有帮助。

First the client binding configuration must be the same as the server, so use the secure transport channel on the client side.首先客户端绑定配置必须和服务端一样,所以使用客户端的安全传输通道。

You can do this through the configuration in the app.config file, or you can refer to the following code:可以通过app.config文件中的配置来实现,也可以参考以下代码:

var ws_http_binding = new WSHttpBinding();

ws_http_binding.Security.Mode = SecurityMode.Transport;

ChannelFactory<IInternal> factory = 
    new ChannelFactory<IInternal>(
        ws_http_binding,
        new EndpointAddress("https://MyMachine:8733/IInternal"));

var channel = factory.CreateChannel();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 提供的URI方案“http”无效; 预期&#39;https&#39; - The provided URI scheme 'http' is invalid; expected 'https' 提供的URI方案“ http”无效; 预期为“ https”。 参数名称:通过 - The provided URI scheme 'http' is invalid; expected 'https'. Parameter name: via 通过HTTPS的NLog LogReceiverService抛出无效的URI方案异常 - NLog LogReceiverService over HTTPS throws invalid URI scheme exception 提供了无效的请求URI。 (堆栈跟踪中没有有用的信息) - An invalid request URI was provided. (No helpful info in the stack trace) WCF-找不到与https端点的方案http匹配的基地址 - WCF - Could not find a base address that matches scheme http for the https endpoint 提供了无效的请求 URI。 请求 URI 必须是绝对 URI 或必须设置 BaseAddress。 尝试使用网络服务 - An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set. trying to consuming a webservice 从 http 到 https,得到“找不到与具有绑定 WebHttpBinding 的端点的方案 http 匹配的基地址” - Going from http to https, getting "Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding" Uri规范化压缩FTP方案 - Uri canonicalization compacting FTP scheme 更改 System.Uri 的方案 - Changing the scheme of System.Uri WCF:找不到与绑定WebHttpBinding的端点的方案http匹配的基地址。 注册的基址方案为[https] - WCF: Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM