The best answers to the question “The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via” in the category Dev.
I am trying to make a WCF service over basicHttpBinding to be used over https. Here’s my web.config:
<!-- language: xml --> <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> ... <behaviors> <serviceBehaviors> <behavior name="MyServices.UpdateServiceBehavior"> <serviceMetadata httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors>
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
Adding this as an answer, just since you can’t do much fancy formatting in comments.
I had the same issue, except I was creating and binding my web service client entirely in code.
Reason is the DLL was being uploaded into a system, which prohibited the use of config files.
Here is the code as it needed to be updated to communicate over SSL…
Public Function GetWebserviceClient() As WebWorker.workerSoapClient Dim binding = New BasicHttpBinding() binding.Name = "WebWorkerSoap" binding.CloseTimeout = TimeSpan.FromMinutes(1) binding.OpenTimeout = TimeSpan.FromMinutes(1) binding.ReceiveTimeout = TimeSpan.FromMinutes(10) binding.SendTimeout = TimeSpan.FromMinutes(1) '// HERE'S THE IMPORTANT BIT FOR SSL binding.Security.Mode = BasicHttpSecurityMode.Transport Dim endpoint = New EndpointAddress("https://myurl/worker.asmx") Return New WebWorker.workerSoapClient(binding, endpoint) End Function
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>
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.
in your web.config file. This change will allow you to use https instead of http