Web服务错误"提供的URI方案'http'是无效的;预计& # 39;https # 39;
本文关键字:http 无效 预计 https URI 错误 服务 quot Web 方案 | 更新日期: 2023-09-27 18:05:37
我有一个服务调用,导致以下错误:"提供的URI方案'http'无效;预计"https"。"
应用程序。配置值:
<basicHttpBinding>
<binding name="xx_xxxxx_spcName" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="655360"
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" />
</security>
</binding>
</basicHttpBinding>
<client>
<endpoint address="http://server/serviceaddress_removed"
binding="basicHttpBinding" bindingConfiguration="xx_xxxxx_spcName"
contract="xx.xx_xxxxx_spcName" name="xx_xxxxx_spcName" />
</client>
我试过Https://,但内部的一切,所以不会期望我需要这个,除此之外,它也给了客户端/服务器错误。
我也试过改变绑定类型
我也看过这里和asp.net上的其他论坛帖子,似乎都指向使用传输和传递客户端凭据,我在我的代码中所做的如下:
client.ClientCredentials.UserName.UserName = "XXXXX";
client.ClientCredentials.UserName.Password = "XXXXX";
必须将<security mode="Transport">
更改为none。
如果我记得我的WCF配置培训,传输安全特别意味着您正在使用HTTPS。如果你不使用HTTPS,你的安全类型应该设置为"None",因为你知道你的消息将是未加密的。
我相信你也可以使用"Message"手动提供证书,但我以前没有这样做过。
下面的代码更改解决了我的问题。从这里。
var Binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
var Binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly)