0

We are trying to access a java webservice through HTTPS from remote system in to our .net client system.we are facing an error:

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

Interesting thing is it is working in SOAP UI,but only problem with visual studio.Why it is working in soap UI rather not in Visual studio2010

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;

}

jazb
  • 5,498
  • 6
  • 37
  • 44
peter
  • 8,158
  • 21
  • 66
  • 119

1 Answers1

1

It is possible that the dotnet framework is related to the version of TLS supported. As far as I know,. Net4.0 is not compatible with tls1.2,you could refer to the following question for details.
Which versions of SSL/TLS does System.Net.WebRequest support?
Set up the configuration by using the following code snippets.

 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
            ServiceReference2.Service1Client client = new ServiceReference2.Service1Client();
            client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication =
 new X509ServiceCertificateAuthentication()
 {
     CertificateValidationMode = X509CertificateValidationMode.None,
     RevocationMode = X509RevocationMode.NoCheck
 };

Feel free to let me know If there is anything I can help with.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22
  • Why soapUI has TLS 1.1 where OS doesnot have,or even ,net does not have??Does it cause issue? – peter Dec 26 '18 at 11:10
  • Tls1.1 is already supported as long as you install Net4.0 (vs2010 built-in). So soapui has been set to use tls1.1 by default. However, this option needs to be explicitly setup in the program. Have you tried to set this option in the program? – Abraham Qian Dec 27 '18 at 09:43