Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

.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
Highlighted
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
Highlighted
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

Highlighted
Partner
Partner

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