tags:

views:

5052

answers:

2

I am trying to make a WCF service over basicHttpBinding to be used over https. Here's my web.config:

  <service behaviorConfiguration="MyServices.PingResultServiceBehavior"
   name="MyServices.PingResultService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="defaultBasicHttpBinding"
     contract="MyServices.IPingResultService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>

...

<bindings>
  <basicHttpBinding>
    <binding name="defaultBasicHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

...

I am connecting using WCFStorm which is able to retrieve all the meta data properly, but when I call the actual method I get:

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

Any ideas?

+2  A: 

Are you running this on the cassini (vs dev server) or on IIS with a cert installed? I have had issues in the past trying to hook up secure endpoints on the dev web server.

Here is the binding configuration that has worked for me in the past. Instead of basicHttpBinding, it uses wsHttpBinding. I don't know if that is a problem for you.

                <!-- Binding settings for HTTPS endpoint -->
            <binding name="WsSecured">
                <security mode="Transport">
                    <transport clientCredentialType="None" />
                    <message clientCredentialType="None" negotiateServiceCredential="false" establishSecurityContext="false" />
                </security>
            </binding>`

and the endpoint

<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WsSecured" contract="IYourContract" />

Also, make sure you change the client configuration to enable Transport security.

pattersonc
local IIS 7 with self-signed cert installed
isg
"Also, make sure you change the client configuration to enable Transport security." -- Good advice. Too easily overlooked and WCF won't give clues in its errors.
Luke Puplett
+3  A: 

Try adding message credentials on your app.config like:

<bindings> 
<basicHttpBinding> 
<binding name="defaultBasicHttpBinding"> 
  <security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
    <message clientCredentialType="Certificate" algorithmSuite="Default" />
  </security> 
</binding> 
</basicHttpBinding> 
</bindings> 
Jojo Sardez