我有一个导致以下错误的服务调用:“提供的 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 上的其他论坛帖子,所有帖子似乎都指向使用 Transport 并传入我在代码中执行的客户端凭据,如下所示:
client.ClientCredentials.UserName.UserName = "XXXXX";
client.ClientCredentials.UserName.Password = "XXXXX";