Java 访问.net中的远程服务时出错
我们正在尝试通过HTTPS从中的远程系统访问java Web服务到我们的.net客户端系统。我们遇到一个错误: 这可能是因为在HTTPS情况下,服务器证书未正确配置为HTTP.SYS。这也可能是由于客户端和服务器之间的安全绑定不匹配造成的 有趣的是它在SOAP UI中工作,但visual studio的唯一问题是它为什么在SOAP UI中工作而不是在visual studio 2010中工作Java 访问.net中的远程服务时出错,java,c#,.net,wcf,Java,C#,.net,Wcf,我们正在尝试通过HTTPS从中的远程系统访问java Web服务到我们的.net客户端系统。我们遇到一个错误: 这可能是因为在HTTPS情况下,服务器证书未正确配置为HTTP.SYS。这也可能是由于客户端和服务器之间的安全绑定不匹配造成的 有趣的是它在SOAP UI中工作,但visual studio的唯一问题是它为什么在SOAP UI中工作而不是在visual studio 2010中工作 protected void Page_Load(object sender, EventArgs e)
protected void Page_Load(object sender, EventArgs e)
{
try
{
ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(CertificationvAlidatefunction);
mainclass.ClientCredentials.UserName.UserName = "testuser";
mainclass.ClientCredentials.UserName.Password = "test123";
response = mainclass.Testmethod(request);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
private bool CertificationvAlidatefunction(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Security.Cryptography.X509Certificates.X509Chain chain, SslPolicyErrors errors)
{
return true;
}dotnet框架可能与所支持的TLS版本相关。据我所知,。Net4.0与tls1.2不兼容,有关详细信息,请参阅以下问题。 使用以下代码段设置配置
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
ServiceReference2.Service1Client client = new ServiceReference2.Service1Client();
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication =
new X509ServiceCertificateAuthentication()
{
CertificateValidationMode = X509CertificateValidationMode.None,
RevocationMode = X509RevocationMode.NoCheck
};
如果有什么我可以帮忙的,请随时告诉我。哪一个是错误?您插入的文本是否为代码?这可能是因为这样一个事实…?是的,这是一个,但在SOAP UI工作中,添加服务引用并得到错误您有权访问更新版本的visual studio吗?没有。我只有VS 2010为什么SOAP UI有TLS 1.1而OS没有,甚至,net没有?是否会导致问题?只要您安装内置的Net4.0 vs2010,就已经支持Tls1.1。因此,soapui已设置为默认使用tls1.1。但是,此选项需要在程序中明确设置。您是否尝试在程序中设置此选项?