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

Sense .NET API, QMC configurations needed?

Do you need to do some configuration in QMC or your local Windows settings to get your .NET Windowsforms to connect to Sense?

I have read the Betahelp for Sense API, but I cannot seem to get around the error, everything compiles fine but I keep geeting a Sockets.SocketException which says 'no connection could be made because target machine actively refused it 127.0.0.1:4848'

Turned off firewall and went through QMC but nothing, I did notice that the port for Engine in QMC is 4747, not 4848, but I guess that's the way it should be.

Any advice? Have anyone tried the .NET API for Sense and have a short and sweet code example to share

12 Replies
Not applicable
Author

var localSenseEngine = Qlik.Engine.Location.Local;

var appIdentifier = localSenseEngine.AppWithName("myAppName.qvf");

using (IApp app = localSenseEngine.App(appIdentifier))

{

    ...

}

For more information see .Net SDK help

https://help.qlik.com/sense/en-us/developer/index.html#../Subsystems/NetSdk/Content/Introduction/Net...

Not applicable
Author

Hmm, no. not working.

My code looks like this

  ILocation myLocation = Qlik.Engine.Location.Local;

        using (IHub hub = myLocation.Hub())

        {

MessageBoxShow(hub.QvVersion());

        }


which results in SocketException "No connection could be made because the target machine actively refused it 127.0.0.1:4848"


I have tried running the Qlik Sense services with Local System, a specific Sense user with Admin rights, checked the firewalls etc... hmm, I cannot see what the problem is.

Michael_Tarallo
Employee
Employee

Hi Markus -

Some clarifications / questions:

  • Is this a new install of the full Qlik Sense platform 1.0?
  • This has nothing to do with Qlik Sense Desktop I assume?
    • 127.0.0.1:4848 - is what Qlik Sense Desktop uses - and there isn't' any QMC
    • When running the full platform - you should not get the above error - only if Qlik Sense Desktop is running
  • Are you performing all dev work for this example on the same machine?
  • Did you completely remove - uninstall any older versions, beta versions etc.
  • If you access https://localhost/qmc - what happens? - Full Qlik Sense Platform with QMC
  • If you access https://localhost/hub - what happens? - Full Qlik Sense Platform with QMC
  • if you access http://localhost:4848/hub what happens?  - Qlik Sense Desktop

We have seen this in a couple of situations (with Qlik Sense Desktop) when a proxy is being used - can you check your internet connection settings and see if you can bypass proxy for local address is checked?

Depending on the answers for the above questions - we have also seen where a previous releases' certificates may need to be removed.

  1. Stop Qlik Sense Repository Service (this will also stop the other services)
  2. Open Microsoft Management Console (MMC). Important: Run this as the account configured to run the services (Run as... )
  3. Add snap-in for Certificates: My user account and Local Computer account
  4. In Certificates - Current User > Trusted Root Certification Authorities > Certificates, delete the certificate created by QlikSense, issued by your computer, computer.domain-CA
  5. In Certificates > Current User > Personal > Certificates, delete the certificate named QlikClient
  6. In Certificates (Local Computer) > Personal > Certificates, delete the certificate issued by computer.domain-CA.
  7. Start Qlik Sense Repository Service and verify it created the new certificates
  8. Start the rest of the services

When logging in to https://localhost/qmc - you can just ignore the certificate error and depending on the borwser you are using, just trust it and accept it - for now. You can also choose to enable http - once you get into the console in the proxy configuration.

Check out the above steps and let us know if this helps.

Mike Tarallo

Regards,
Mike Tarallo
Qlik
Not applicable
Author

I do not have Sense Desktop installed, only Sense Platform 1.0 GA.

I cannot connect http://localhost:4848/hub  (but again, do not have Desktop installed, only https works for hub and QMC).

I have had no other previous installs, this is on fresh Windows with no Sense Beta software previously.

I will try removing the certificates.

Michael_Tarallo
Employee
Employee

Hi Markus - good - so now we know what we are dealing with.

  • You stated that you can get into the hub and qmc without issue correct?

What is odd, is that in your original post, you are getting a connection refused to a port that is not in use with the Qlik Sense platform system. (4848) So this makes me think there is a misconfiguration in your program somewhere. Possibly a hard-coded value somewhere?

I checked my server and this is what I found:

Here is my proxy configuration

Here are my listening ports: - using netstat -a -p tcp

As you can see I don't see port 4848

If you have a functioning Qlik Sense environment - I can only assume you followed these instructions:

https://help.qlik.com/sense/en-us/developer/index.html#../Subsystems/NetSdk/Content/GettingStarted/N...

I would suggest to follow from the start and make sure the prerequisites are in order too:

https://help.qlik.com/sense/en-us/developer/index.html#../Subsystems/NetSdk/Content/Introduction/Net...

Let us know how you do.

Mike

Regards,
Mike Tarallo
Qlik
Not applicable
Author

If you are not running a desktop you should use :

ILocation myLocation = Qlik.Engine.Location.LocalServer;

if the qlik engine is running on the same machine or better would be to use


Uri uri = new Uri("http://<machine>:<port>");

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

where port should be 4747.

Not applicable
Author

Thanks both Lars-Goran and Michael!

I still can't get around this, if you say nothing should be pointing at 4848, and I have not specified any ports myself, my Proxy settings looks like Michaels.

I did two tests, incorporated your advice.

Test1)

( Note! 4848 is NOT configured by my anywhere, netstat shows listening port as 4747)

ILocation myLocation = Qlik.Engine.Location.LocalServer;

        using (IHub hub = myLocation.Hub())

        {

            MessageBox.Show(hub.QvVersion());

        }

Results in:

SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:4848    

Test2)

   Uri uri = new Uri("http://win7devbox:4747");

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

      //  ILocation myLocation = Qlik.Engine.Location.LocalServer;

        using (IHub hub = myLocation.Hub())

        {

            MessageBox.Show(hub.QvVersion());

        }

Results in:

System.TimeoutException was thrown: "QlikConnection "Open" timed out"

So yes, it does seems like I cannot reach port 4747, but according to netstat it's listening.

I haven't started to remove certificiates yet, BUT this is a clean 1.0GA install on a squeaky clean Win7 install.

Not applicable
Author

Ok, Michael, so I checked the certificates, seems something wrong. I didn't find any Trusted Root Certification Authorities created by QlikSense, only a CurrentUser/Personal ceritificate named QlikClient.

Is this where everything goes wrong? Hmm, it's just strange, on a fresh install with bascially installing by next-next-next....

Not applicable
Author

If the uri fails to resolve it will default to "ws://127.0.0.1:4848", the uri could fail to resolve if you are running with too low rights to see the Sense instance in the list of running processes or if the process is called something else than QlikSense or Engine.


one workaround would be to specify the Uri explicitly as you are doing, but then you also need specify explicitly the way to authenticate.


var location = Location.FromUri(uri);

location.AsNtlmUserViaProxy();

or

var location = Location.FromUri(uri);

location.AsStaticHeaderUserViaProxy("<userId>");