https with WCF error: “Could not find base address that matches scheme https”

前端 未结 7 1497
南旧
南旧 2020-12-23 19:42

I go to https://mywebsite/MyApp/Myservice.svc and get the following error:

(The link works if I use http:// )

\"The service \'/MyApp/MyService.svc\' cann

相关标签:
7条回答
  • 2020-12-23 20:18

    I had this exact same problem. Except my solution was to add an "s" to the binding value.

    Old: binding="mexHttpBinding"

    New: binding="mexHttpsBinding"

    web.config snippet:

    <services>
        <service behaviorConfiguration="ServiceBehavior" name="LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService">
            <endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" 
                contract="LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService" />
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        </service>
    
    0 讨论(0)
  • 2020-12-23 20:20

    It turned out that my problem was that I was using a load balancer to handle the SSL, which then sent it over http to the actual server, which then complained.

    Description of a fix is here: http://blog.hackedbrain.com/2006/09/26/how-to-ssl-passthrough-with-wcf-or-transportwithmessagecredential-over-plain-http/

    Edit: I fixed my problem, which was slightly different, after talking to microsoft support.

    My silverlight app had its endpoint address in code going over https to the load balancer. The load balancer then changed the endpoint address to http and to point to the actual server that it was going to. So on each server's web config I added a listenUri for the endpoint that was http instead of https

    <endpoint address="" listenUri="http://[LOAD_BALANCER_ADDRESS]" ... />
    
    0 讨论(0)
  • 2020-12-23 20:27

    I was using webHttpBinding and forgot to dicate the security mode of "Transport" on the binding configuration which caused the error:

      <webHttpBinding>
        <binding name="MyWCFServiceEndpoint">
          <security mode="Transport" />
        </binding>
      </webHttpBinding>
    

    Adding this in configuration fixed the problem.

    0 讨论(0)
  • 2020-12-23 20:30

    I think you are trying to configure your service in a similar way to the following config. There is more information here: Specify a Service with Two Endpoints Using Different Binding Values. Also, other than for development, it's probably not a good idea to have both HTTP & HTTPS endpoints to the same service. It kinda defeats the purpose of HTTPS. Hope this helps!

    <service type="HelloWorld, IndigoConfig, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null">
        <endpoint
            address="http://computer:8080/Hello"
            contract="HelloWorld, IndigoConfig, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
            binding="basicHttpBinding"
            bindingConfiguration="shortTimeout"
        </endpoint>
        <endpoint
            address="http://computer:8080/Hello"
            contract="HelloWorld, IndigoConfig, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
            binding="basicHttpBinding"
            bindingConfiguration="Secure"
         </endpoint>
    </service>
    <bindings>
        <basicHttpBinding 
            name="shortTimeout"
            timeout="00:00:00:01" 
         />
         <basicHttpBinding 
            name="Secure">
            <Security mode="Transport" />
         </basicHttpBinding>
    </bindings>
    
    0 讨论(0)
  • 2020-12-23 20:35

    Look at your base address and your endpoint address (can't see it in your sample code). most likely you missed a column or some other typo e.g. https// instead of https://

    0 讨论(0)
  • 2020-12-23 20:40

    In my case i am setting security mode to "TransportCredentialOnly" instead of "Transport" in binding. Changing it resolved the issue

    <bindings>
      <webHttpBinding>
        <binding name="webHttpSecure">
          <security mode="Transport">
            <transport clientCredentialType="Windows" ></transport>
          </security>
          </binding>
      </webHttpBinding>
    </bindings>
    
    0 讨论(0)
提交回复
热议问题