COM Exception when connecting to the project

qcConnection.InitConnectionEx(_qcSettings.ServerUrl);

// Attempt to log in
qcConnection.Login(apiKey, secretKey);
if (qcConnection.Connected)
{

qcConnection.Connect(SelectedDomain,SelectedProject);
}

I am able to login but failing to connect to the project. 
I have an old solution with ASP.Net on .net4.8 and trying to upgrade to .net core with C# Razor pages. 
old solution - I am still able to connect but with the new solution, its giving me COM exception. 
I have checked project and domain exists and are passed correctly. seen the values while debugging. 

can anyone help?