views:

124

answers:

2

Hello colleagues. I've created wcf service and want use http and https version. Service is hosted by IIS 6.0.

At my config I have:

  <bindings>
  <basicHttpBinding>
    <binding name="BindingConfiguration1" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      <security mode="TransportWithMessageCredential">
        <transport clientCredentialType="None"/>
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings> 
 <services>
  <service name="RegistratorService.Registrator" behaviorConfiguration="RegistratorService.Service1Behavior">
    <endpoint binding="basicHttpBinding"
              contract="RegistratorService.IRegistrator"
              bindingConfiguration="BindingConfiguration1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint binding="basicHttpBinding" contract="RegistratorService.IRegistrator">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://aurit-server2" />
      </baseAddresses>
    </host>
  </service>
</services>

But even at browser I've got exception "The provided URI scheme 'http' is invalid; expected 'https'"

What's wrong? Thanks.

A: 

do you have SSL set up in IIS6 for the website hosting WCF. If you do make sure you don't have SSL required checked if you want to allow both http and https

Stephen Dolier
A: 

You need two endpoints with two different binding configurations to configure a service for http and https. Configure the first endpoint for https with your existing binding configuration (usage of TransportWithMessageCredential) and the second endpoint without it for using http.

The error you actually get is a result of mixing up an http address and TransportWithMessageCredential.

Dirk