Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
master_t
Partner - Creator II
Partner - Creator II

.NET SDK - error connecting to QlikSense through certificate

Hello

I'm trying to use the .NET SDK to connect to a QlikSense server (febbruary 2018 version) using a certificate.

I exported the certificate from the QMC (including private key) and then I try to use this code:

Uri uri = new Uri("https://mysenseserver.local");

var senseLocation = Qlik.Engine.Location.FromUri(uri);

//Load certificate

X509Certificate2 x509 = new X509Certificate2(@"C:\client.pfx", "cert_password", X509KeyStorageFlags.UserKeySet);

X509Certificate2Collection x509coll = new X509Certificate2Collection(x509);

//Connect to QlikSense server

senseLocation.AsDirectConnection(

    "myuserdir", //User directory

    "administrator", //UserID (this user is RootAdmin)

    false,

    false,

    x509coll //Certificate

);

//Connect to app

var appIdentifiers = senseLocation.GetAppIdentifiers(); //This causes exception...

this causes the following exception:

GeneralCommunicationException with communication error WebSocketClosed and http error code 500

   at Qlik.Engine.Communication.QlikConnection.AwaitResponseTask(T task, String methodName, CancellationToken cancellationToken)

   at Qlik.Engine.Communication.QlikConnection.Ping(Nullable`1 noVersionCheck)

   at Qlik.Engine.LocationExtensions.Hub(ILocation location, ISession session, Nullable`1 noVersionCheck)

   at Qlik.Engine.LocationExtensions.GetAppIdentifiers(ILocation location, Nullable`1 noVersionCheck)

   at QlikExporter.Core.Logic.SenseAgent.ConnectToApp()

can anyone tell me what I'm doing wrong?

1 Solution

Accepted Solutions
Øystein_Kolsrud
Employee
Employee

If you do a direct connection, then you should typically add the Engine port number to the Uri. Default value for this is 4747 for a Server installation of Qlik Sense (4848 for desktop). Check out this example:

https://github.com/AptkQlik/PublicExamples/blob/master/ConnectDirectLocalServer/ConnectDirectLocalSe...

View solution in original post

2 Replies
Øystein_Kolsrud
Employee
Employee

If you do a direct connection, then you should typically add the Engine port number to the Uri. Default value for this is 4747 for a Server installation of Qlik Sense (4848 for desktop). Check out this example:

https://github.com/AptkQlik/PublicExamples/blob/master/ConnectDirectLocalServer/ConnectDirectLocalSe...

master_t
Partner - Creator II
Partner - Creator II
Author

Thanks, that was the issue! Port 4747 is working correctly.