4
我想消費位於https://TestServices/ServiceList.asmx的網絡服務。當我嘗試將服務引用添加到我的C#庫類項目我app.config文件看起來像如下:如何通過https消費網絡服務
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TestServicesSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="50000000" maxBufferPoolSize="524288" maxReceivedMessageSize="50000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="">
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://TestServices/ServiceList.asmx"
binding="basicHttpBinding" bindingConfiguration="TestServicesSoap"
contract="TestServices.TestServicesSoap" name="TestServicesSoap" />
</client>
</system.serviceModel>
即使當我試圖出於某種原因終點地址添加服務參考https://TestServices/ServiceList.asmx仍然指向http://TestServices/ServiceList.asmx。我嘗試將http更改爲https,但出現以下錯誤:
提供的URI方案'https'無效;預計'http'。 參數名稱:via
在https上使用Web服務的正確方式是什麼?
[提供的URI方案的「https」的可能的複製是無效;預計'http'。參數名稱:via](https://stackoverflow.com/questions/2435823/the-provided-uri-scheme-https-is-invalid-expected-http-parameter-name-via) – paulsm4 2017-07-25 22:59:31