facing issue in ASP.NET Core 2.2 “The provided URI scheme ‘https’ is invalid; expected ‘http’.\r\nParameter name: via”

Getting error in Consuming Galileo Flight UAPI API in asp.net core 2.2. When call async method getting one error

The provided URI scheme ‘https’ is invalid; expected ‘http’. Parameter name: via

I have updated lib as per .net core required and change BasicHttpBinding

I have changed in proxy based on search google and Stackoverflow.

private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
{
    if ((endpointConfiguration == EndpointConfiguration.AirLowFareSearchPort))
    {
        System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
        result.MaxBufferSize = int.MaxValue;
        result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
        result.MaxReceivedMessageSize = int.MaxValue;
        result.AllowCookies = true;
        result.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport;
        result.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Ntlm;
        result.TransferMode = System.ServiceModel.TransferMode.Buffered;
        return result;
    }
    throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
}
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
AirLowFareSearchPortTypeClient client = 
    new AirLowFareSearchPortTypeClient(AirLowFareSearchPortTypeClient.EndpointConfiguration.AirLowFareSearchPort, uRL + "/AirService");

client.ClientCredentials.UserName.UserName = username;
client.ClientCredentials.UserName.Password = password;

 var httpHeaders = Helper.ReturnHttpHeader(username, password);
client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders));
SessionContext context = new SessionContext();
var serviceResponse = await client.serviceAsync(context, lowFareSearchReq);

Solution

Create own BasicHttpBinding object and set “Transport” Security.Mode and other properties, assign to PortType Client. here is code.

 System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();
binding.MaxBufferSize = int.MaxValue;
binding.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
binding.MaxReceivedMessageSize = int.MaxValue;
binding.AllowCookies = true;
binding.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport;
binding.TransferMode = System.ServiceModel.TransferMode.Buffered;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
var endpoint = new EndpointAddress(uRL + "/AirService");
//AirLowFareSearchPortTypeClient client = new AirLowFareSearchPortTypeClient(AirLowFareSearchPortTypeClient.EndpointConfiguration.AirLowFareSearchPort, uRL + "/AirService");
AirLowFareSearchPortTypeClient client = new AirLowFareSearchPortTypeClient(binding, endpoint);

Thanks

Dharmesh Sharma