gpt4 book ai didi

c# - 自定义绑定(bind) : The provided URI scheme 'https' is invalid; expected 'http' . 参数名称:via

转载 作者:太空宇宙 更新时间:2023-11-03 13:57:56 25 4
gpt4 key购买 nike

我找遍了 stackoverflow 和互联网,仍然找不到解决方案我已经设置了一个带有“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,但仍然没有成功。

最佳答案

CodeProject 上有一篇关于此的好文章:SSL for self hosted WCF service

关于c# - 自定义绑定(bind) : The provided URI scheme 'https' is invalid; expected 'http' . 参数名称:via,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11563389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com