Web Services Web服务错误“提供的URI方案'http'无效;应为'https',”

3xiyfsfu  于 2023-03-23  发布在  其他
关注(0)|答案(3)|浏览(442)

我有一个服务呼叫,导致以下错误:“提供的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://,但是所有的东西都是内部的,所以我不希望我需要这个,此外,它还给出了一个客户端/服务器错误。
我也尝试过改变绑定类型
我还浏览了这里和www.example.com上的其他论坛帖子asp.net,所有帖子似乎都指向使用Transport并传递客户端凭据,我在代码中这样做:

client.ClientCredentials.UserName.UserName = "XXXXX";
client.ClientCredentials.UserName.Password = "XXXXX";
5lwkijsr

5lwkijsr1#

必须将<security mode="Transport">更改为none。传输强制使用https。

gywdnpxw

gywdnpxw2#

如果我还记得我的WCF配置培训,传输安全性特别意味着您正在使用HTTPS。如果您没有使用HTTPS,则应将安全类型设置为“无”,因为您知道您的消息将是未加密的。
我相信你也可以使用“消息”并手动提供证书,但我以前没有这样做过。

p5cysglq

p5cysglq3#

下面的代码更改解决了我的问题。来自here

var Binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)

var Binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly)

相关问题