自定义绑定:提供的 URI 方案“https”无效;预期的“http”。参数名称:via
Posted
技术标签:
【中文标题】自定义绑定:提供的 URI 方案“https”无效;预期的“http”。参数名称:via【英文标题】:Custom binding: The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via 【发布时间】:2012-07-18 18:54:52 【问题描述】:我查看了 *** 和互联网,仍然找不到解决方案 我已经设置了一个带有“https”端点的自定义 basichttpbinding。 当我调用该方法时,它一直返回我异常:
提供的 URI 方案“https”无效;预期的“http”。参数名称:via
var endPoint = new EndpointAddress("https://xxxxx/v2_soap/index/");
var binding = new BasicHttpBinding
Name = "HandlerBinding",
CloseTimeout = TimeSpan.FromMinutes(1.0),
HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
MessageEncoding = WSMessageEncoding.Text,
MaxReceivedMessageSize = 65536000,
MaxBufferPoolSize = 65536000,
UseDefaultWebProxy = true,
AllowCookies = false,
BypassProxyOnLocal = false,
Security =
Mode =BasicHttpSecurityMode.Transport,
Transport =
ClientCredentialType = HttpClientCredentialType.None,
ProxyCredentialType = HttpProxyCredentialType.None
,
Message =
ClientCredentialType = BasicHttpMessageCredentialType.UserName
;
以上设置与VS添加服务引用时生成的app.config完全相同:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="HandlerBinding" 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="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://xxxxx/v2_soap/index/?SID=qttkobaa5jrmaj22il8mn9n342"
binding="basicHttpBinding" bindingConfiguration="HandlerBinding"
contract="HandlerPortType"
name="HandlerPort" />
</client>
</system.serviceModel>
我什至尝试从 basichttpbinding 更改为 WSHttpBinding,但仍然没有成功。
【问题讨论】:
参考***.com/questions/2435823/… 【参考方案1】:CodeProject 上有一篇很好的文章:SSL for self hosted WCF service
【讨论】:
以上是关于自定义绑定:提供的 URI 方案“https”无效;预期的“http”。参数名称:via的主要内容,如果未能解决你的问题,请参考以下文章
提供的 URI 方案“https”无效;预期的“http”。参数名称:通过
从服务中获取错误“提供的 uri 方案'https'是无效的预期'http”