wcf - 提供的URI方案'https'无效;应为'http' 参数名称:通过 HTTPS

我尝试将安全模式更改为'Transport',然后错误为如下所示:" Could not establish secure channel for SSL/TLS with authority'xxx.xxx.xxx.xxx:XXXX'. "

服务器配置:


<system.serviceModel>
 <services>
 <service behaviorConfiguration="NameofServiceBehaviour" name="NameOfServices">
 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndPointBinding" name="wsHttpEndPoint" contract="Name.IContractName" />
 </service>
 </services>
 <bindings>
 <wsHttpBinding>
 <binding name="wsHttpEndPointBinding">
 <security mode="None"> 
 <!-- <transport clientCredentialType="Certificate" /> -->
 </security>
 </binding>
 </wsHttpBinding>
 </bindings>
 <behaviors>
 <serviceBehaviors>
 <behavior name="ServiceBehaviourName">
 <serviceMetadata httpGetEnabled="true" />
 <serviceDebug includeExceptionDetailInFaults="false" />
 <!-- <serviceCredentials>
 <serviceCertificate findValue="CN=CertificateName" storeLocation="LocalMachine" />
 </serviceCredentials> -->
 </behavior>
 </serviceBehaviors>
 </behaviors>
 <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
 </system.serviceModel>

客户端配置:


<system.serviceModel>
 <bindings>
 <wsHttpBinding>
 <binding name="wsHttpEndPoint">
 <security mode="None" />
 </binding>
 </wsHttpBinding>
 </bindings>
 <client>
 <endpoint address="https://URL.svc"
 binding="wsHttpBinding" bindingConfiguration="wsHttpEndPoint"
 contract="Name.IContractName" name="wsHttpEndPoint" />
 </client>
 </system.serviceModel>

时间:

关键是在自定义绑定中设置以下参数:


<security allowInsecureTransport="true" enableUnsecuredResponse="true">

...