AptkQlik / PublicExamples

33 stars 20 forks source link

Unable to connect Qlik sense Server #5

Open mohit-llp opened 6 years ago

mohit-llp commented 6 years ago

Hi There is a problem to connect qlik sense through static header as well as remote server. Exception: {Qlik.Sense.JsonRpc.CommunicationErrorException: Connection failed after 4 attempts. Error message: The remote certificate is invalid according to the validation procedure. ---> System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult) at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result) at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult) at Qlik.Sense.Communication.Communication.Tcp.StreamFactory.<>c.b8_1(SslStream ss, IAsyncResult result) at Qlik.Sense.Communication.Communication.Tcp.StreamFactory.<>c__DisplayClass10_1.b2(IAsyncResult result) --- End of inner exception stack trace --- at Qlik.Sense.JsonRpc.RpcConnection.d43.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Qlik.Sense.JsonRpc.RpcConnection.d54.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Qlik.Sense.JsonRpc.RpcConnection.d__52.MoveNext() --- End of inner exception stack trace --- at Qlik.Engine.Communication.QlikConnection.AwaitResponseTask[T](T task, String methodName, CancellationToken cancellationToken) at Qlik.Engine.Communication.QlikConnection.Ping(Nullable1 noVersionCheck) at Qlik.Engine.LocationExtensions.Hub(ILocation location, ISession session, Nullable1 noVersionCheck) at ConnectServerStaticHeader.Program.PrintQlikSenseVersionNumber(ILocation location) .

I am easily connect to qlik sense desktop. My qlik sense version :Sept`18.

please help.

wennmo commented 6 years ago

Hi @mohit-llp, the error you are receiving indicates that the installed certificate used on your Sense installation is not valid. It is possible to disable certificate validation in the .NET SDK when connecting by setting certificateValidation to false.

https://help.qlik.com/en-US/sense-developer/September2018/apis/net+sdk/html/M_Qlik_Sense_JsonRpc_ILocation_AsStaticHeaderUserViaProxyAsync.htm.

I would however still recommend that you check why the certificate is invalid. Ignoring the certificate errors should only be considered as a workaround.

mohit-llp commented 6 years ago

Hi After setting certification validation to false, I got a new error- {GeneralCommunicationException with communication error WebSocketClosed and http error code 500}

wennmo commented 6 years ago

Ok, have you checked the troubleshooting section for the .NET SDK regarding connecting to Qlik Sense server?

https://help.qlik.com/en-US/sense-developer/September2018/Content/Sense_Helpsites/Troubleshooting-developer.htm

A common problem is the whitelisting needed in the QMC which is described in that section.

mohit-llp commented 6 years ago

Hi, I have checked all the parameters in QMC, but got the same error.

{Qlik.Engine.Communication.CommunicationErrorException: Connection failed after 4 attempts. Error message: GeneralCommunicationException with communication error WebSocketClosed and http error code 500 at Qlik.Engine.Communication.QlikConnection.AwaitResponseTask[T](T task, String methodName, CancellationToken cancellationToken) at Qlik.Engine.Communication.QlikConnection.Ping(Nullable1 noVersionCheck) at Qlik.Engine.LocationExtensions.Hub(ILocation location, ISession session, Nullable1 noVersionCheck)

wennmo commented 6 years ago

Have you tried connecting with e.g. NTLM authentication or any other type of authentication?

mohit-llp commented 6 years ago

I have used NTLM authentication e.g "location.AsNtlmUserViaProxy(true);" then I got an error

{Qlik.Engine.Communication.CommunicationErrorException: Connection failed after 4 attempts. Error message: The remote server returned an error: (401) Unauthorized. The remote server returned an error: (401) Unauthorized. The remote server returned an error: (401) Unauthorized. The remote server returned an error: (401) Unauthorized. at Qlik.Engine.Communication.QlikConnection.AwaitResponseTask[T](T task, String methodName, CancellationToken cancellationToken) at Qlik.Engine.Communication.QlikConnection.Ping(Nullable1 noVersionCheck) at Qlik.Engine.LocationExtensions.Hub(ILocation location, ISession session, Nullable1 noVersionCheck)

If I used "location.AsNtlmUserViaProxy(false);" then i got an error: {Qlik.Engine.Communication.CommunicationErrorException: Connection failed after 4 attempts. Error message: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. at Qlik.Engine.Communication.QlikConnection.AwaitResponseTask[T](T task, String methodName, CancellationToken cancellationToken) at Qlik.Engine.Communication.QlikConnection.Ping(Nullable1 noVersionCheck) at Qlik.Engine.LocationExtensions.Hub(ILocation location, ISession session, Nullable1 noVersionCheck)

Please help.

wennmo commented 6 years ago

Can you share some code snippet of how you are trying to connect? Would also be good if you describe the configuration of the server e.g. virtual proxy settings. The authentication is failing, so it looks like it's most likely due to a configuration in the QMC. Have you been able to connect to earlier versions of Qlik Sense Server?