The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via for HTTPS

时间秒杀一切 提交于 2019-12-12 07:38:53

问题


Following is the scenario.

We have F5 load balancer and incoming requests comes in to the F5 load balancer as HTTPs and then they are redirected to WCF services server as HTTP.

I have tried almost all possible configuration combinations but it keeps giving two different errors. For example, in light of few suggestions, I have tried changing security mode to 'Transport' then the error changes to as follows: "Could not establish secure channel for SSL/TLS with authority 'xxx.xxx.xxx.xxx:XXXX'."

Server Configuration:

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

Client Configuration:

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

Regards, Nasir


回答1:


Under Load Balancer I have had this problem and the fix was on the client side like this:

<system.serviceModel>        
    <bindings>
      <customBinding>
        <binding name="MyBindingConfig">
          <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
          </textMessageEncoding>
          <httpsTransport  authenticationScheme="Anonymous" bypassProxyOnLocal="false" proxyAuthenticationScheme="Anonymous"/>
        </binding>
      </customBinding>
    </bindings> 
    <client>
        <endpoint address="https://YOUR-END-POINTURL-WITH-HTTPS"
            binding="customBinding" bindingConfiguration="MyBindingConfig"
            contract="ServiceReference.YOURCONTRACT" name="TEST" />
    </client>
</system.serviceModel>

Also you can see that when you add the webservice reference on VisualStudio and you put the URL with HTTPS it will be adding automatically the URL on the client end point child (client app.config) without the S so (HTTP because the loadbalancer) then you can go ahead and update that with HTTPS as I did on the above example. Hope it help.




回答2:


I found the answer with this link. The key was to set the following parameters in the custom binding:

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


来源:https://stackoverflow.com/questions/32206169/the-provided-uri-scheme-https-is-invalid-expected-http-parameter-name-via

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!