In C#, I am trying to access a web service located on an HTTPS address. My code is defined in a class library, which is referred to in the main application(s) using DLLs — so the standard way of configuring the web services with an App.config file is not possible here.
My code is essentially equal to the following:
var remoteAddress = new System.ServiceModel.EndpointAddress(
    "https://myUrl.com/Service.svc");
MyServiceClient myClient = new MyServiceClient(
    new System.ServiceModel.WSHttpBinding(),
    remoteAddress);
myClient.ClientCredentials.ClientCertificate.SetCertificate(
    StoreLocation.CurrentUser,
    StoreName.My,
    X509FindType.FindByThumbprint,
    "91 47 0b e8 80 bf ee 68 32 93 f0 d4 ee e6 14 8c e5 0c fa 3e"
    );
myClient.Endpoint.Binding.SendTimeout = new TimeSpan(0, 0, 0, 10);
var myResult = myClient.MyMethod("foo bar");
But even though I use WSHttpBinding I get an ArgumentException with the message:
The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: via
Can anyone spot what the problem is?
 
     
    