Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF On HTTPS Generates "The provided URI scheme 'https' is invalid; expected 'http'."

I have been googling everywhere I can possibly find (including here on Stackoverflow) to figure out an error I've got trying to deploy a WCF service to IIS 7.5 on Windows 7 x64 that runs only over SSL with basic HTTP authentication. I've got a site in IIS which has a binding to port 50443 for HTTPS with a self-signed cert. (I can't use the standard port 443, as we plan on deploying this to IIS on a server which is already running Tomcat which is listening on 80 and 443.)

This is the web.config:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="SSLBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="HelloWorldWcf.HelloWorldWcfService">
        <endpoint name="HelloWorldWcf.HelloWorldWcfService" 
                  address="https://mylaptop:50443/HelloWorld/Service1.svc" 
                  binding="basicHttpBinding" 
                  bindingConfiguration="SSLBinding" 
                  contract="HelloWorldWcf.IHelloWorldWcfService"/>
        <endpoint address="https://mylaptop:50443/HelloWorld/Service1.svc/mex" 
                  binding="mexHttpsBinding" 
                  contract="IMetadataExchange"/>
      </service>
    </services>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

If I browse to the service endpoint address and enter the basic authentication credentials manually, I get the following exception error message displayed in my browser:

The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: context.ListenUriBaseAddress

This is the same error I got trying to run a WCF client against a similar service, except that it ends with "Parameter name: via" (because the parameter name of the method that shows up in the call stack, "System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(URI via)", is in fact "via").

I've tweaked the server and client config files so many times I've lost track, but the web.config file above is my best guess so far--and it doesn't even work from a browser, much less a WCF client.

What do I need to do to access a WCF service hosted in IIS 7.5 on a nonstandard SSL port with basic HTTP authentication over HTTPS? Help! (& Thanks!)

like image 583
ALEXintlsos Avatar asked Mar 11 '26 20:03

ALEXintlsos


1 Answers

try add this to binding

<security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
    <message clientCredentialType="Certificate" algorithmSuite="Default" />
</security> 
like image 82
burning_LEGION Avatar answered Mar 13 '26 14:03

burning_LEGION



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!