openopc2 icon indicating copy to clipboard operation
openopc2 copied to clipboard

Got two errors during connection for 32 and 64 bit installation: OPCError: Class not registered and ConnectionRefusedError

Open danilNil opened this issue 10 months ago • 11 comments

Hi there!

I want to use this library for connecting to OPC DA from linux machine. However I can not even get local connection to OPC DA server working. Please help me to figure out where my mistake is.

Environment

Windows Server 2016 Standart 64 bit Python 3.10.11 - 64 bit in windows shell and Python 3.11.4 32 bit under miniconda3

Steps to reproduce

32 bits installation

  1. install OPC Core Components Redistributable (x86) 3.00.107
  2. Restart windows server
  3. Compiled 32 bit zzzOpenOPCService by using instruction from this comment https://github.com/ya-mouse/openopc/issues/5#issuecomment-1372523350 and put it to Program Files (x86)
  4. Install and start service OpenOPCService
  5. Copy 32 bit version of gbda_aut.dll to SysWoW64
  6. Move to SysWoW64 folder and run %SystemRoot%\SysWoW64\regsvr32 gbda_aut.dll
  7. Install MatriconOPCSimulator and run it
  8. Setup env variables
    1. OPC_CLASS=OPC.Automation
    2. OPC_CLIENT=OpenOPC
    3. OPC_GATE_HOST={server-ip} (tried with localhost as well)
    4. OPC_GATE_PORT=7766
    5. OPC_HOST=localhost
    6. OPC_MODE=dcom
    7. OPC_SERVER=Matrikon.OPC.Simulation
  9. Create inbound outbound rule for port 7766 (tried with turned off firewall as well)
  10. Download and install openopc2 via pip under 32 bit version of Python in miniconda3
  11. Run python -m openopc2 list-servers in miniconda shell and got
    1. [11:11:49] ERROR Could not connect to OPC server: cannot connect to ({server-ip}, 7766): [WinError 10061] cli.py:344 No connection could be made because the target machine actively refused it

64 bit installation

  1. install OPC Core Components Redistributable (x64) 3.00.107
  2. Restart windows server
  3. Delete previous installed OpenOPCService and uninstall gbda_aut.dll
  4. Download OpenOPCService from https://github.com/iterativ/openopc2/releases/tag/0.1.11 and put it to Program Files
  5. Install and start service OpenOPCService
  6. Copy 64 bit version of gbda_aut.dll to System32
  7. Got to System32 and run regsvr32 gbda_aut.dll
  8. Setup env variables
    1. OPC_CLASS=OPC.Automation
    2. OPC_CLIENT=OpenOPC
    3. OPC_GATE_HOST={server-ip}
    4. OPC_GATE_PORT=7766
    5. OPC_HOST=localhost
    6. OPC_MODE=dcom
    7. OPC_SERVER=Matrikon.OPC.Simulation
  9. Create inbound outbound rule for port 7766 (tried with turned off firewall as well)
  10. Download OpenOPCCli from https://github.com/iterativ/openopc2/releases/tag/0.1.11 and put it to Program Files
  11. Run openopcCLI server-info
  12. Got
    1. OPCError: (OPCError(...), 'Dispatch: (-2147221164, 'Class not registered', None, None) opc_class:"OPC.Automation"') [13832] Failed to execute script 'cli' due to unhandled exception!

danilNil avatar Aug 11 '23 10:08 danilNil