I m trying to connect to a wcf service hosted with https
I passed the right Credentials to the server
enter code here var channel = new ConfigurationChannelFactory<C>(serviceConfigName, pluginConfig, new EndpointAddress(Url));
if (!string.IsNullOrEmpty(UserName))
{
channel.Credentials.UserName.UserName = UserName;
channel.Credentials.UserName.Password = Password;
channel.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
}
return channel;
and I used the below configuration
<configuration>
<system.serviceModel>
<client>
<endpoint
name="ms_basic_http"
address="http://localhost"
binding="basicHttpBinding"
bindingConfiguration="defaultBasicHttpsBinding"
contract="ICONTRACT" />
</client>
<bindings>
<basicHttpBinding >
<binding name="defaultBasicHttpsBinding">
<security mode="Message">
<transport clientCredentialType="Basic" realm="BS" />
<message clientCredentialType="UserName" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
but getting the below response from the server
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="BS'