Specified SSL Protocol Type is not Valid
See original GitHub issueI am using an application that is imbedded within Autodesk Revit levering their open API. I have worked inside this context for a couple years and connected to other industry DB platform without any issues.
1. I have the application that makes a call to another dll (pgRDG)
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace RDG_Revit_2022.Testing
{
[Transaction(TransactionMode.Manual)]
class Test : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiapp = commandData.Application;
Document doc = uiapp.ActiveUIDocument.Document;
//This is the external reference call
pg.RDG.Connection.Testing();
return Result.Succeeded;
}
}
}
2. Then here is the Testing() method.
using System;
using System.Windows;
using Npgsql;
namespace pgRDG
{
public class Connection
{
public static void Testing()
{
string ConnString = "Server=name.postgres.database.azure.com;Database=dbName;Port=5432;User Id=uid;Password=pw;Trust Server Certificate=true;Ssl Mode=Require";
using(NpgsqlConnection conn = new NpgsqlConnection(ConnString))
{
try
{
conn.Open();
NpgsqlCommand cmd = new NpgsqlCommand("SELECT * FROM tableName", conn);
NpgsqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
MessageBox.Show(reader.GetString(reader.GetOrdinal("command")));
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
}
The issue
- When I run this I receive the following error:
If I run this exact same code from a desktop application it connects fine, but always produces this error within the Revit context.
I have also created a request on the Autodesk forums thinking someone there may have an idea as well. https://forums.autodesk.com/t5/revit-api-forum/revit-2022-environment-preventing-ssl-handshake-with-postgresql/td-p/10304990
Further technical details
Npgsql version: 6.0.0-preview2 PostgreSQL version: Azure version 11 Operating system: Window 10 x64 - Visual Studio Pro 19 - v16.8.4 Autodesk Revit 2022
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (7 by maintainers)
I appreciate you all working on this. Preview3 (6.0.0) was the first install that got past the missing reference for Text.JSON but it was throwing this SSL Protocol error for me. I have downloaded the latest unstable version (20210521T094529 which doesn’t throw the SSL Protocol warning or at least doesn’t get there because its back missing references for Text.JSON 5.0.0.0 even with redirects for 5.0.0.2.
Sure, works for me.