Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GeneralCommunicationException with communication error WebSocketSendOnClosed and http error code 500

Hi,

I am not able to locate qlik sense server using Dot Net SDK.

error message is:

Connection failed after 4 attempts. Unable to keep connection open: Failed to ensure open connection: GeneralCommunicationException with communication error WebSocketSendOnClosed and http error code 500.



I have already added my IP-Address in web socket whitelist in virtual proxy.

this is my code sample

  try

            {

                Uri uri = new Uri("http://ServerIP:873");

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

                location.VirtualProxyPath = "virproxy";

                 location.AsStaticHeaderUserViaProxy("User ID", null, false);

                using (IHub hub = location.Hub())

                {

                    label1.Text = hub.ProductVersion();

                }

            }

            catch (Qlik.Engine.Communication.CommunicationErrorException communicationException)

            {

                throw communicationException;

            }

15 Replies
Øystein_Kolsrud
Employee
Employee

Hi! I see you use "null" for the argument "headerAuthenticationHeaderName" in your call to "AsStaticHeaderUserViaProxy". Can you try to set explicitly set it to the corresponding value for your virtual proxy? You'll find the name in the "Authentication" section for the virtual proxy settings in the QMC.

Not applicable
Author

Thanks for reply.

Sorry I did not get your point, what value should pass to second argument in AsStaticHeaderUserViaProxy() function.

this is my proxy setting. Please help

ProxySetting.PNG

Øystein_Kolsrud
Employee
Employee

Ah, it looks like that virtual proxy does not use static header authentication but authentication method "Ticket". Perhaps you should connect using NTLM authentication?

Try this method: location.AsNtlmUserViaProxy(false);

http://help.qlik.com/en-US/sense-developer/2.2/apis/net%20sdk/html/M_Qlik_Engine_LocationExtensions_...

Not applicable
Author

I have tried the same, In that case other error occurred.

Error Detail:

Connection failed after 4 attempts. Unable to keep connection open: Failed to ensure open connection: One or more errors occurred.

Updated Code:

               Uri uri = new Uri("http://ServerIP:873");

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

               location.VirtualProxyPath = "virproxy";

           location.AsNtlmUserViaProxy(false);

               

           using (IHub hub = location.Hub()) //error occurred here.

            {

               label1.Text = hub.ProductVersion();

            }

Øystein_Kolsrud
Employee
Employee

OK, here are three other suggestions for you:

1) Check that you are connecting to the right port.

2) Check that your proxy allows http-connections.

3) Check that your QMC is aware of your user.

Instructions for the three steps follows here:

1) Check that you are connecting to the right port.

In the QMC, check you port settings by following these steps:

- Select "Proxies" in the "CONFIGURE SYSTEM" section of the start page.

- Select the "Central" proxy and click the button "Edit".

- Check the "Ports" section under "Properties".

The port in your connection URI needs to match service listen port relevant for the protocol you are using when connecting. If you use "https", the port must match the port listed in "Service list port HTTPS". If you use "http", the port must match the port listed in "Service listen port HTTP".

Default settings are "443" for "https", and "80" for "http". If you do not add a port to your URI, then these ports will be assumed.

2) Check that your proxy allows http-connections.

In the QMC, check you http configuration settings by following these steps:

- Select "Proxies" in the "CONFIGURE SYSTEM" section of the start page.

- Select the "Central" proxy and click the button "Edit".

- Check the "Ports" section under "Properties".

Is the "Allow HTTP" check box checked? If it is not, then you will have to use "https" when connecting to the server.

3) Check that your QMC is aware of your user.

In the QMC, check your user configuration by following these steps:

- Select "Users" in the "MANAGE CONTENT" section of the start page.

- In the column "User ID", click the filter icon, and type your login user name.

Check that your user is there and that the "User directory" of the user matches the user domain of your login account. If your user is not there, or the "User directory" does not match, then you will not be able to login using NTLM. If your Qlik Sense server should contain your user, then you should check that your "User directory connectors" are configured correctly.

Not applicable
Author

I have tried all the three steps i.e

  • Connection to port is right
  • Proxy Allow HTTP connection
  • QMC has User - I can logon to Qlik Sense Hub using the same Username Password and User I am trying with has Root Admin access in QMC

But still the same issue.

Øystein_Kolsrud
Employee
Employee

Have you tried to connect using https?

Not applicable
Author

Yes I have tried with https also, but getting same error.

Even I have created new virtual proxy.

  • Set authentication method to "Header Authentication static user directory"
  • Set Header authentication header name
  • Provided Header authentication static user directory
  • And finally set     location.AsStaticHeaderUserViaProxy("UserID", "hdr-var",false);

I attaching New virtual directory setting and code sample screen shot.ProxySetting.PNGPort_Setting.PNGCode_Sample.PNG

Øystein_Kolsrud
Employee
Employee

Your screen shot for the virtual proxy seems to be the other virtual proxy you had (the one with the prefix "VirProxy"). Can you add one for the new one?