Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to fix this Error : An exception of type 'Qlik.Engine.Communication.CommunicationErrorException' occurred in Qlik.Engine.dll but was not handled in user code Additional information: Connection failed after 4 attempts.

Hello ,

         I am trying to connect with QlikSense through .Net SDK , My qliksense server is hosted in my dedicated server , i am able to access from my browser . When i connect them from the .Net SDK code , it throws the following error :

Connection failed after 4 attempts. Error message:
  The handshake failed due to an unexpected packet format.


I would like to paste my code for your view :


       ILocation location = Qlik.Engine.Location.FromUri(new Uri("http://myserverip:port/"));

        location.AsDirectConnectionToPersonalEdition();

        using (IHub hub = location.Hub())

        {

            string value = hub.ProductVersion();

        }

can you please help to fix this issue .

Thanks for your support.

3 Replies
Alexander_Thor
Employee
Employee

AsDirectConnectionToPersonalEdition indicates you are connecting to a Qlik Sense Desktop instance and not a Server.

You probably wanna connect using the NTML methods instead if you want to authenticate against the Server

Not applicable
Author

Thanks Alex ,

         I have constructed the code as per your suggestion , please find the code below :

          var uri = new Uri("https://myQlikSenseServer.myDomain.com:port");

          ILocation location = Qlik.Engine.Location.FromUri(uri);

          location.AsNtlmUserViaProxy(proxyUsesSsl:true);

          The same error occurs again.

        I have some clarifications in my mind , i would like to bring to your notice . they are :

       1. Is it possible authenticate qliksense server using the code itself , i don't want the page to ask the Username and Password ?, and where to hard code the Credentials ?

       2. do i need to give any permissions to give access to my server , in order to connect from the .Net SDK code ?

       3. i have download the sample application given by the Community (PublicExamples) , using this code , i am trying to connect my server , the same error occurs again and again .

Please give me a solutions for this problems .

Thanks .

jbj
Employee
Employee

Do you have a valid certificate for the proxy you're connecting to?

If not you can test to override certificate validation using:

location.AsNtlmUserViaProxy(certificateValidation:false);