ASP.NET Core 5.0/C#/MVC Web app error: The requested security protocol is not supported.

ASP.NET Core 5.0/C#/MVC Web app error: The requested security protocol is not supported.

Anonymous
Not applicable
3,442 Views
4 Replies
Message 1 of 5

ASP.NET Core 5.0/C#/MVC Web app error: The requested security protocol is not supported.

Anonymous
Not applicable

We would like to have Vault logic built into our business logic through an internal Web app. Testing a connection to our vault server, we get the error "The requested security protocol is not supported."

 

Error:

System.TypeInitializationException: 'The type initializer for 'Autodesk.DataManagement.Client.Framework.Vault.Library' threw an exception.'

Inner Exception
NotSupportedException: The requested security protocol is not supported.

 

Code:

public static Connection VaultConnection()
{
VDF.Vault.Results.LogInResult results = VDF.Vault.Library.ConnectionManager.LogIn("Server", "Name", "Administrator", "", AuthenticationFlags.Standard, null);
Connection connection = results.Connection;
return connection;
}

public static bool VaultConnectionStatus()
{
return VaultConnection().IsConnected;
}

public string Index()
{
return $"Vault Connection: {VaultConnectionStatus()}";
}

 

Using statements:

using Autodesk.DataManagement.Client.Framework.Vault.Currency.Connections;
using Autodesk.Connectivity.WebServices;
using Autodesk.Connectivity.WebServicesTools;
using VDF = Autodesk.DataManagement.Client.Framework;

 

References (x64):

Autodesk.DataManagement.Client.Framework.Vault.dll
Autodesk.DataManagement.Client.Framework.dll
Autodesk.Connectivity.WebServices.WCF.dll
Autodesk.Connectivity.WebServices.dll
Autodesk.Connectivity.Extensibility.Framework.dll

 

Environment:

IDE: Visual Studio 2019 | .Net core 5.0 | using IIS Express to test
Vault Server: Vault Basic Server 2021.1.1 Build 26.1.152.0
0 Likes
Accepted solutions (1)
3,443 Views
4 Replies
Replies (4)
Message 2 of 5

olegd.prod
Autodesk
Autodesk
Are you connecting to the Vault server using HTTPS?
If so, how is that configured on the server? Does it require a specific protocol?

.NET FW code below is based on a guess. Try to put it into your app's startup procedure. I haven't tested it with .NET Core

var vals = Enum.GetValues(typeof(SecurityProtocolType)).Cast();
SecurityProtocolType res = SecurityProtocolType.SystemDefault;
foreach (var item in vals)
{
res = res | item;
}

ServicePointManager.SecurityProtocol = res;

0 Likes
Message 3 of 5

Anonymous
Not applicable
Accepted solution

It is not connecting via https.

 

//Ssl3 | Tls | Tls11 | Tls12 | Tls13
var vals = Enum.GetValues(typeof(SecurityProtocolType)).Cast<SecurityProtocolType>();
SecurityProtocolType res = SecurityProtocolType.SystemDefault;
foreach (var item in vals)
{
    res |= item;
}
            
ServicePointManager.SecurityProtocol = res;

 

I added the code above, and I receive the exact same error. I actually commented out the vault connection code and just tried to set the SecurityProtocol via your code, and I received the exact same error. 

 

It seems to be related to being a .Net Core 5.0 project. I created a new project at .Net Framework 4.7.2 and set the Platform Target to x64 and Bitness to x64 and I was able to connect to our vault server without issue.

 

I'd still like to get the .Net Core 5.0 project working. Is there a different way to handle the SecurityProtocol in .Net Core 5.0? Do the vault DLL's work inside the .Net Core 5.0 environment?

0 Likes
Message 4 of 5

olegd.prod
Autodesk
Autodesk
We haven't tested the SDK with .NET Core, only with the FW, so not sure exactly what's going on.

Sounds like you have a way to move forward
0 Likes
Message 5 of 5

Anonymous
Not applicable
I do not believe that .NET Core is currently supported. I have seen several threads asking whether it was, and I believe the majority of the answers are no or not yet.