WCF Error: "mismatch of the security binding between the client and the server"
WCF Error: "mismatch of the security binding between the client and the server"
所以我有两个项目调用相同的第 3 方 SOAP 服务。两个项目(项目 A 和项目 B)具有相同的配置,并且都是 运行 .NET 4.7.2。
项目 B 完美运行,但项目 A 抛出以下异常:
An error occurred while making the HTTP request to https://XXXXXXXXXX.
This could be due to the fact that the server certificate is not
configured properly with HTTP.SYS in the HTTPS case. This could also
be caused by a mismatch of the security binding between the client and
the server.
我已将项目 A 中的安全协议设置为匹配项目 B(Ssl3 && Tls)。我也尝试过使用 HTTP 而不是 HTTPS。
项目 A -
网络 Api 项目
.NET 4.7.2
项目 B -
控制台应用程序
.NET 4.7.2
如有任何建议,我们将不胜感激。
添加代理服务器设置(不知道我们有一个)解决了我的问题。
参见下面的示例代码:
private string SendDataExample()
{
using (var client = new ServiceClient())
{
SetProxy(client.Endpoint.Binding as BasicHttpBinding);
}
}
private void SetProxy(BasicHttpBinding binding)
{
binding.ProxyAddress = new Uri($"http://localHost:8080");
binding.BypassProxyOnLocal = false;
binding.UseDefaultWebProxy = false;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm;
}
所以我有两个项目调用相同的第 3 方 SOAP 服务。两个项目(项目 A 和项目 B)具有相同的配置,并且都是 运行 .NET 4.7.2。 项目 B 完美运行,但项目 A 抛出以下异常:
An error occurred while making the HTTP request to https://XXXXXXXXXX. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
我已将项目 A 中的安全协议设置为匹配项目 B(Ssl3 && Tls)。我也尝试过使用 HTTP 而不是 HTTPS。
项目 A - 网络 Api 项目 .NET 4.7.2
项目 B - 控制台应用程序 .NET 4.7.2
如有任何建议,我们将不胜感激。
添加代理服务器设置(不知道我们有一个)解决了我的问题。
参见下面的示例代码:
private string SendDataExample()
{
using (var client = new ServiceClient())
{
SetProxy(client.Endpoint.Binding as BasicHttpBinding);
}
}
private void SetProxy(BasicHttpBinding binding)
{
binding.ProxyAddress = new Uri($"http://localHost:8080");
binding.BypassProxyOnLocal = false;
binding.UseDefaultWebProxy = false;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm;
}