我正在尝试访问需要身份验证的 Soap Web 服务 (HTTP)。我正在使用 WCF 来使用该服务。我收到错误消息,因为 HTTP 请求未经客户端身份验证方案“基本”授权。从服务器收到的身份验证标头是“Basic realm="weblogic"”。
任何帮助表示赞赏,谢谢。
这就是我的代码的样子:
var binding = new BasicHttpBinding();
binding.MaxBufferSize = 2147483647;
binding.MaxReceivedMessageSize = 2147483647;
binding.Security = new BasicHttpSecurity
{
Mode = BasicHttpSecurityMode.TransportCredentialOnly,
Transport = new HttpTransportSecurity()
{
ClientCredentialType = HttpClientCredentialType.Basic
}
};
var endpoint = new System.ServiceModel.EndpointAddress(configuration["webserviceAddres"]);
servicio = new ConsultaMontosOperadosFondosClient(binding, endpoint);
servicio.ClientCredentials.UserName.Password = MyPass;
servicio.ClientCredentials.UserName.UserName = MyUser;