siempre que el esquema URI 'http' no sea válido; esperado 'https'
Tengo un servicio web RESTful alojado en IIS 6.0, puedo navegar por el servicio en el navegador. Cuando intento acceder al mismo servicio a través de la aplicación de la consola del Cliente, me aparece el siguiente error:
"provided URI scheme'http' is invalid; expected 'https', Parameter name: Via"
Mi WebService web.config tiene esta configuración:
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="TestAPI">
<endpoint address="" behaviorConfiguration="RESTFriendly" binding="webHttpBinding" contract="ITestAPI" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="RESTFriendly">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
La aplicación de mi cliente tiene App.config desde donde obtengo la dirección:
<appSettings>
<add key="WEBSERVICE" value="URL"/>
En el método principal:
WebChannelFactory<ITestAPI> cf = new WebChannelFactory<IAPI>(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();
Cuando intenta llamar a TestMethod, me da este error.