This error typically occurs when there's an SSL/TLS certificate validation issue when connecting to an Odoo instance. Since you're using "odoo.local", it's likely a local development environment with a self-signed certificate.
While your code already includes a certificate validation bypass using DangerousAcceptAnyServerCertificateValidator, there might be a few things to try:
- First, verify the URL is correct and accessible:
static readonly string odooUrl = "https://odoo.local";
// Try using http instead if SSL is not properly configured:
// static readonly string odooUrl = "http://odoo.local";
- You could try adding more detailed certificate handling:
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) =>
{
// Log the specific SSL error for debugging
Console.WriteLine($"SSL Policy Errors: {sslPolicyErrors}");
return true; // Accept all certificates
}
};
-
If you're using Windows, you might need to add the certificate to your trusted root store. You can export the certificate from your browser and import it to Windows certificate store.
-
You could also try adding security protocols explicitly:
System.Net.ServicePointManager.SecurityProtocol =
SecurityProtocolType.Tls12 |
SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls;
- Check if your Odoo instance is actually running and accessible by trying to reach it in a web browser first.
Could you try accessing the Odoo URL in your browser and let me know if it works? Also, what operating system are you using? This would help narrow down the specific solution needed.