I'm updating the NF-e communication for some clients and in general I'm not having problems for licensors like Rio Grande do Sul and São Paulo, for example.
But I can not make Goias work at all.
Namely, I made a simple Console Application, in which I inserted a service reference for the Authorization Service of Goiás NFe (requires digital certificate):
The error happens whenever I call the remote method "nfeAuthorization": System.ServiceModel.Security.SecurityNegotiationException: 'A secure channel for SSL / TLS with authority' homolog.sefaz.go.gov.br 'could not be established. '
Namely: the certificate chain is properly installed.
OnethingIfoundstrangeisthatalthoughthewsdlisonanHTTPS,theendpointresolvedbytheserviceishttp.
<client><endpointaddress="http://homolog.sefaz.go.gov.br:80/nfe/services/NFeAutorizacao4"
binding="customBinding" bindingConfiguration="NFeAutorizacao4ServiceBinding"
contract="Hom.Goias.NFeAutorizacao4Service" name="NFeAutorizacao4Port" />
</client>
If I force https, my error is timeout.
My code is as follows:
static void Main(string[] args)
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
var client = new Hom.Goias.NFeAutorizacao4ServiceClient();
client.ClientCredentials.ClientCertificate.Certificate =
new System.Security.Cryptography.X509Certificates.X509Certificate2(@"D:\Projects\XPTO\CERT.pfx", "SENHADOCERTIFICADO");
var xdoc = new XmlDocument();
xdoc.Load(@"d:\Projects\XPTO\nfe-go.xml");
var resp = client.nfeAutorizacaoLote(xdoc);
Console.ReadKey();
}
Any suggestions are welcome!