Web服务错误“提供的URI方案'http'无效;预期'https'。”

时间:2013-03-25 14:43:19

标签: c# asp.net web-services

我有一个服务调用导致以下错误:“提供的URI方案'http'无效;预期'https'。”

app.config值:

<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";

2 个答案:

答案 0 :(得分:9)

您必须将<security mode="Transport">更改为无。运输部队https。

答案 1 :(得分:0)

如果我记得我的WCF配置培训,则传输安全性特别意味着您正在使用HTTPS。如果您不使用HTTPS,则应将您的安全类型设置为“无”,因为您知道您的邮件未加密。

我相信您也可以使用“消息”并手动提供证书,但我之前没有这样做过。

相关问题