Hi All,
I refer to the following pages to try to connect Qlik Sense: Sample code for how to connect to Qlik Sense ‒ Qlik Sense, but I got below error:
'The remote certificate is invalid according to the validation procedure.'
I found the solution in Troubleshooting connection ‒ Qlik Sense and have installed the certificate on my local machine, it still doesn't work. My code is like below:
using System;
using Qlik.Engine;
using Qlik.Engine.Communication;
using System.Net;
using System.Net.Security;
namespace ConnectServerNTLM
{
class Program
{
static void Main(string[] args)
{
var uri = new Uri("https://w12qs");
if (args.Length > 0)
{
uri = new Uri(args[0]);
}
ILocation location = SetupConnection(uri);
PrintQlikSenseVersionNumber(location);
}
private static ILocation SetupConnection(Uri uri)
{
ILocation location = Qlik.Engine.Location.FromUri(uri);
var domain = "myDomain";
var user = "myUserID";
var pwd = "myPassword";
location.AsNtlmUserViaProxy(proxyUsesSsl: uri.Scheme.Equals(Uri.UriSchemeHttps), loginCredentials: new NetworkCredential(user, pwd, domain));
return location;
}
private static void PrintQlikSenseVersionNumber(ILocation location)
{
try
{
using (IHub hub = location.Hub(noVersionCheck: true))
{
Console.WriteLine(hub.ProductVersion());
}
}
catch (CommunicationErrorException cex)
{
Console.WriteLine("Can not connect to Qlik Sense instance, check that Qlik Sense is running." + Environment.NewLine + cex.Message);
}
catch (Exception ex)
{
Console.WriteLine("General error." + Environment.NewLine + ex.Message);
}
Console.ReadLine();
}
}
}
Thanks & Regards,
Shyee
Try setting the "certificateValidation" parameter to "false" in your call to "AsNtlmUserViaProxy". Like this:
location.AsNtlmUserViaProxy(
proxyUsesSsl: uri.Scheme.Equals(Uri.UriSchemeHttps),
loginCredentials: new NetworkCredential(user, pwd, domain),
certificateValidation: false);
Try setting the "certificateValidation" parameter to "false" in your call to "AsNtlmUserViaProxy". Like this:
location.AsNtlmUserViaProxy(
proxyUsesSsl: uri.Scheme.Equals(Uri.UriSchemeHttps),
loginCredentials: new NetworkCredential(user, pwd, domain),
certificateValidation: false);
Thanks Kolsrud! I tried the solution but got another error: Method "QTProduct" timed out.
Hmm...What Qlik Sense version are you connecting to? For older versions you had to add your domain to the host white list in the QMC. That setting is found among the "Advanced" entries in the Virtual Proxy configurations.
It could potentially be a firewall setting as well. You could try to temporarily disabling the firewall and see if that makes a difference.
Thanks Kolsrud!!!! I made it!!! Today I restart my pc and the program, it works!!! But I really don't know how did it work... I didn't set anything. Thank you so much!!
PS: My Qlik Sense version is 3.2.0 and the program result just like picture attached, thx.
hello,
i am facing the same problem
server 1: my qlik sense enterprise hosted in azure, it worked in the first try
server 2:
Thanks in advance
private void Form1_Load(object sender, EventArgs e) { Uri uri = new Uri("https://xxx/yyy/"); ILocation location = Qlik.Engine.Location.FromUri(uri); var domain = "xxxx"; var user = "xxxx"; var pass = "xxxx"; location.AsNtlmUserViaProxy( certificateValidation: false, proxyUsesSsl: uri.Scheme.Equals(Uri.UriSchemeHttps), loginCredentials: new NetworkCredential(user, pass, domain)); using (IHub hub = location.Hub()) { NxEngineVersion engine = new NxEngineVersion(); engine = hub.EngineVersion(); label1.Text = engine.ComponentVersion; } }