![](/img/trans.png)
[英]Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http]
[英]I have HTTP scheme and HTTPS is expected, but my binding is BasicHttpSecurityMode.Transport; And my EndPoint is HTTP
我的 Soap 客户端出现身份验证问题,它没有正确接收凭据。 这是一个基本的身份验证(用户名和密码),显然这是一个绑定问题。
对于身份验证问题,我跳过了这个问题:
System.ServiceModel.Security.MessageSecurityException: 'HTTP 请求未经“匿名”客户端身份验证方案授权。 从服务器收到的身份验证标头是“Basic realm="SAP NetWeaver Application Server [PRD/400]"”。
要解决它,请使用binding.Security.Mode = BasicHttpSecurityMode.Transport;
. 但现在我有一个新问题说:
System.ArgumentException: '提供的 URI 方案“http”无效; “https”是预期的。 Arg_ParamName_Name'
我不明白的是为什么当我使用提供安全性的 BasicHttpSecurityMode.Transport 是 HTTPS 时,它告诉我方案是 HTTP 并需要 HTTPS
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
SoapClient client = new SoapClient(binding, endpoint);
client.ClientCredentials.UserName.UserName = _userName;
client.ClientCredentials.UserName.Password = _password;
await client.OpenAsync();
编辑:
现在我尝试使用BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
但这给了我同样的第一个错误:
System.ServiceModel.Security.MessageSecurityException: 'HTTP 请求未经“匿名”客户端身份验证方案授权。 从服务器收到的身份验证标头是“Basic realm="SAP NetWeaver Application Server [PRD/400]"”。
binding.Security.Mode = BasicHttpSecurityMode.Transport;
将其设置为 HTTPS,但您传递的是 HTTP。 如果端点是 HTTP 而不是 HTTPS,它将失败。
System.ServiceModel.Security.MessageSecurityException: 'HTTP 请求未经“匿名”客户端身份验证方案授权。 从服务器收到的身份验证标头是“Basic realm="SAP NetWeaver Application Server [PRD/400]"”。
错误的密码也可能是此错误消息的原因。
确保服务器和客户端的配置相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.