Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
benholcomb007
Contributor II
Contributor II

Qlik Sense .NET Framework API Max Sessions Issue

    We are using the Qlik Sense .NET Framework API to automate Qlik Sense Application Executions.
We have it working fine, but the user that we are using to authenticate with will get the
Multiple Parralell sessions error. This is simply getting application list and variables for a selected application.
I am using the ILocation class to do the app query and it works fine. I also am doing a Dispose on the object after use.

    The issue is this: After so many calls to the API, we will get the Max Sessions error, like the Qlik server is not
releasing the connection.

    Now the question: How can I get Qlik Sense to release the connection when I am done with the ILocation interface?

 

Here is an example of the code for getting the app list objects:

ILocation _location = null;

List<IAppIdentifier> _allApps = null;

try
{
    _location = Qlik.Engine.Location.FromUri(new Uri($"wss://{qlikServer}"));
    NetworkCredential cred = new System.Net.NetworkCredential(userLoginName, password, "DOMAIN");
    _location.AsNtlmUserViaProxy(false, cred, true);
    //Do operation (In this case get the app list)
    _allApps = new List<IAppIdentifier>(_location.GetAppIdentifiers());
}
catch (Exception ex)
{
    //Handle Exception
}
finally
{
    if(_location != null)
        _location.Dispose();
}

This example is getting the ap list from the location.  But if I did this a few more times, it will give the Max Session error like the WebSocket is not releasing its connection.

Thanks,

    Ben

2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The "slot" is counted for a few minutes even after dispose.  Not generally an issue for real people moving between machines, but can be a problem for programs repeatedly opening/closing.  Here are a couple of suggestions. 

1. Don't release the Location. Instead cache it and reuse it. 

2. Use a certificate connection to connect directly to the engine rather than the proxy.  The engine connection doesn't have the connection limit problems.  Using certificate may not match your security requirements or use case. 

-Rob

View solution in original post

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The "slot" is counted for a few minutes even after dispose.  Not generally an issue for real people moving between machines, but can be a problem for programs repeatedly opening/closing.  Here are a couple of suggestions. 

1. Don't release the Location. Instead cache it and reuse it. 

2. Use a certificate connection to connect directly to the engine rather than the proxy.  The engine connection doesn't have the connection limit problems.  Using certificate may not match your security requirements or use case. 

-Rob

benholcomb007
Contributor II
Contributor II
Author

Thanks for the response.

How should we go about using the cert in code?

Is there an article/link for setting this up on the Qlik Server?

Thanks in advance,

    Ben