LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to NI OPC server gives "Access is denied"?

In the distributed system manager (DSM) I can see that the local OPC1/NI OPC Client Status is Active=true, Connected=false.

When I enable diagnostics I get HRESULT=0x80070005 Access is denied.

 

| |-GetCLSID: ProgID=National Instruments.NIOPCServers.V5, Machine="", CLSID=0-0-0-00-000000 (FAILED, HRESULT=0x80070005 Access is denied. )

 

I have been playing with the settings for both Component Services/DCOM and Services/NI OPC server & NI OPC server AE. People say that I should "run as interatice user". That is now available, greyed out for some reason. I suceeded to set a named local user for both Component/DCOM and Services/NI OPC, but no improvement. Also a working setup on another PC has both users as system=default.

 

Any ideas?

 

Earlier post: OPC server 2012 cannot connect to Labview 2012 most of the times?

 https://forums.ni.com/t5/LabVIEW/OPC-server-2012-cannot-connect-to-Labview-2012-most-of-the-times/m-...

 

Diagostics from NI OPC server

OPC I/O Server Diagnostic Information

02/06/2018 11:35:19,617 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:22,268 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:24,947 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:27,618 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:29,697 [Connection] SetGroupState (SUCCEEDED)
02/06/2018 11:35:29,697 [Connection] Reconnect: (SUCCEEDED)
02/06/2018 11:35:29,697 |-[Connection] Disconnect: (SUCCEEDED)
02/06/2018 11:35:29,697 |-[Connection] Connect: (SUCCEEDED)
02/06/2018 11:35:29,697 | |-GetCLSID: ProgID=National Instruments.NIOPCServers.V5, Machine="", CLSID=0-0-0-00-000000 (FAILED, HRESULT=0x80070005 Access is denied. )
02/06/2018 11:35:29,708 | |-GetCLSID: ProgID=National Instruments.NIOPCServers.V5, Machine="", CLSID=0-0-0-00-000000 (FAILED, HRESULT=0x80070005 Access is denied. )
02/06/2018 11:35:30,268 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:32,637 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:34,968 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:36,907 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:37,637 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:40,287 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:42,967 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:45,628 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:48,287 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:50,957 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:53,627 [Browse] Browse: (SUCCEEDED)
02/06/2018 11:35:55,387 [ReleaseAll]: (SUCCEEDED)
02/06/2018 11:35:55,387 |-[Connection] Disconnect: (SUCCEEDED)
02/06/2018 11:35:55,387 [Connection] Disconnect: (SUCCEEDED)
0 Kudos
Message 1 of 6
(4,878 Views)

I think I found the solution, it is really, really strange!

If I put in a shortcut in Autostart (Shell:common startup) to my exe program that accesses the OPC tags it seems to work. The important step is the question I get at first restart

"The program xx has limited access to some resources... do you want to allow access

(X) private networks

(  ) public networks"

After I say YES to both public and private networks the OPC server is accessible in my program.

 

But how do I force windows (10 or 7) to ask me this question? I usually get this question the first time a new compiled version of the program is autostarted. But now I cannot repeat this to prove that this is the solution.

 

I also removed and reinstalled the DSC runtime 2012 inkl OPC server 2012, but still no question on my programs.

Since I don't get question anymore, I don't know exactly how it reads, so I cannot search for an answer.

 

I feels I am so close to the solution, if you can help me with this basic question!

 

/Ola

 

DSM when no OPC-tags visible.png

0 Kudos
Message 2 of 6
(4,848 Views)

I think such settings are stored into the advanced settings of the Windows fiirewall.

Check in the Control Panel firewall settings. You should be able to remove and add programs.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 6
(4,843 Views)

Thanks Paolo! Yes I found the settings in windows firewall. The two versions of my labview executable that has worked correctly is there.

But this is only part of the problem/solution.

- It is not enough to have the program listed here. None of the two versions listed can access the OPC server..

- It is not per program, either all versions can access OPC or none.

- Disabling the windows firewall does not help.

- My best correlation is still: "After restart of the pc with one of the versions of my program in autostart I get the question about unlocking private/public networks - and after that that pc is ok. All versions of my program work. The OPC tags are visible in DSM". I think unlocking question comes when the program starts to access OPC via shared variables.

- Only I cannot force windows 10 to ask me this question anymore! Even newly compiled versions will not get this at autostart.

- Maybe I did a mistake and said yes to "Always trust installers/programs from NI" during reinstallation  of DSC runtime / OPC?

 

The case continues...

0 Kudos
Message 4 of 6
(4,831 Views)

Frankly, I don't understand. Since you can force applications to be enabled or disabled on any kind of network (can you?), what's the point in getting Windows ask for something?

Furthermore, the error highlighted in red in your first post seems to refer to a reading in the Windows registry (getting a Class ID number from there). This should be unrelated to the network issue. Are you launching your app as a plain user?

On the other side, there are conditions where your app work perfectly, so probably the red error message is misleading.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 6
(4,820 Views)

Paolo, can you tell more about the error message in registry "getting a class id"? Somehow the access to the local OPC-server must be blocked.

 

My latest tests suggest that the windows firewall path might be irrelevant.(It came from my observation that a not working pc goes to a working pc each time after I get the question from windows firewall to "allow this program...")

 

I found a local pc here at the office where I could try to install everything again (no, Labview runtime 2012, OPC server 2012 and DSC runtime 2012 was already installed).

When I started my Labviewprogram it deploys the Library "OPC-Library" ok.

In distributed system manager it looks like:

PC2-OPC-access denied.png

So no PLC available under OPC1 (see below for how it looks when ok.)

Steps I took, and these made this PC working:

  1. Enable diagnostics in OPC1 (file attached, shows access denied).
  2. Opened the OPC servers configuration, Save As... just to give my OPC config a new name.
  3. Put a shortcut into Common startup to start my program.
  4. Restarted the PC
  5. Now DSM shows access to OPC server:
    PC2-OPC server accessible.png
  6. So it works for this PC!

But I have done the same, and many varieties of it in the production environment and that still stays at Access denied (was working with earlier version of my program).

Also I really need to understand how to repeat this setup, I've done it a few times the latest years and I usually succeed in a few days, but how?

 

/Ola

 

 

0 Kudos
Message 6 of 6
(4,812 Views)