I'm having the following error accessing a https url:
O esquema de URI do provedor 'https' é inválido; esperado 'http'.\r\nNome do parâmetro: via
My file at
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="https://teste.com.br/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="ServiceBinding1" contract="ServiceReference.ServiceContract"
name="ServiceBinding" />
</client>
<bindings>
<wsHttpBinding>
<binding name="ServiceBinding1" maxReceivedMessageSize="2147483647">
<reliableSession enabled="true" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
I tried the following also:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<client>
<endpoint address="https://teste.com.br/AgroMobileWCF/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="ServiceBinding1" contract="ServiceReference.ServiceContract"
name="ServiceBinding1" />
</client>
<bindings>
<wsHttpBinding>
<binding name="ServiceBinding1" maxReceivedMessageSize="2147483647">
<reliableSession enabled="true" />
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
I got the following error:
Falha na validação de associação porque o WSHttpBinding não oferece suporte a sessões confiáveis em segurança de transporte (HTTPS). A fábrica de canais ou host de serviço não pôde ser aberto. Use a segurança de mensagem para proteger a troca de mensagens confiáveis em HTTP.
Requisition code:
public void Connect()
{
try
{
if (client != null)
client.Disconnect();
}
catch { }
try
{
ServiceReference.ServiceContractClient.CacheSetting = CacheSetting.AlwaysOn;
client = new ServiceReference.ServiceContractClient();
TimeSpan ts = new TimeSpan(0, 0, 0, 11);
client.Endpoint.Binding.CloseTimeout = ts;
client.Endpoint.Binding.OpenTimeout = ts;
client.Endpoint.Binding.ReceiveTimeout = ts;
client.Endpoint.Binding.SendTimeout = ts;
client.Connect();
var loginResult = (ServiceReference.LoginResult)client.SendLogin("CT", 1);
if (!"OK".Equals(loginResult.STATUS))
throw new Exception("Erro: " + loginResult.MENSAGEM);
}
catch (Exception ex) { return; }// throw ex; }
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class ServiceContractClient : System.ServiceModel.ClientBase<LarWS.ServiceReference.ServiceContract>, LarWS.ServiceReference.ServiceContract {
public LarWS.ServiceReference.Message Connect() {
return base.Channel.Connect();
}
}