Ver Mensaje Individual
  #1074  
Antiguo 17-05-2017
dgalindosaeta dgalindosaeta is offline
Registrado
NULL
 
Registrado: may 2017
Posts: 2
Reputación: 0
dgalindosaeta Va por buen camino
Error SSL/TLS en c#

Hola amigos, he visto que hay gente que está montando el proyecto en C#. Me gustaría que nos comunicásemos para sacar en conjunto el tema. Resolví el error que he leído por ahí que da:

The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were:

Lo he resuelto poniendo el certificado, pero ahora tengo un error de comunicación:

No se pudo establecer un canal seguro para SSL/TLS con la autoridad 'www7aeates'

Y aunque le he añadido:

Código:
using System.Net;
using System.Net.Security;

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
Pero aún así no hay forma. Os pongo todo el código para que veáis:

Código:
                    System.Net.ServicePointManager.Expect100Continue = false;
                    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11;
                    ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

                    BasicHttpBinding binding = new BasicHttpBinding();
                    binding.Name = "siiBinding";                    
                    binding.Security.Mode = BasicHttpSecurityMode.Transport;
                    //binding.Security.Mode = SecurityMode.Transport;
                    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;

                    FacturasEmitidas.siiSOAPClient Servicio = new FacturasEmitidas.siiSOAPClient("SuministroFactEmitidasPruebas", new EndpointAddress("https://www7.aeat.es/wlpl/SSII-FACT/ws/fe/SiiFactFEV1SOAP"));
                    Servicio.Endpoint.Binding = binding;

                    Servicio.ClientCredentials.ClientCertificate.Certificate = cFunciones.EncontrarCertificado(DatosEnvio.NombreCertificado);
                    Servicio.ClientCredentials.UseIdentityConfiguration = true;
Responder Con Cita