[英]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.