提供的URI方案’http’无效; 预期’https’

我在IIS 6.0中托管了RESTful Web服务,我可以在浏览器中浏览服务。 当我尝试通过客户端控制台应用程序访问相同的服务时,它给我以下错误:

"provided URI scheme'http' is invalid; expected 'https', Parameter name: Via" 

我的WebService web.config具有以下设置:

                     

我的客户端应用程序有App.config从我获取地址:

   

在Main方法中:

 WebChannelFactory cf = new WebChannelFactory(baseAddress); WebHttpBinding wb =cf.Endpoint.Binding as WebHttpBinding; wb.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; wb.Security.Mode = WebHttpSecurityMode.Transport; cf.Credentials.UserName.UserName = "usermane"; cf.Credentials.UserName.Password = "password"; ITestAPI channel = cf.CreateChannel(); string msg = channel.TestMethod(); 

当它试图调用TestMethod时,它给了我这个错误。

您正在使用以下行将安全性设置为传输模式(HTTPS):

wb.Security.Mode = WebHttpSecurityMode.Transport;

baseAddress的值是HTTP还是HTTPS地址?