openopc2
openopc2 copied to clipboard
Got two errors during connection for 32 and 64 bit installation: OPCError: Class not registered and ConnectionRefusedError
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
- install OPC Core Components Redistributable (x86) 3.00.107
- Restart windows server
- 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)
- Install and start service OpenOPCService
- Copy 32 bit version of gbda_aut.dll to SysWoW64
- Move to SysWoW64 folder and run %SystemRoot%\SysWoW64\regsvr32 gbda_aut.dll
- Install MatriconOPCSimulator and run it
- Setup env variables
- OPC_CLASS=OPC.Automation
- OPC_CLIENT=OpenOPC
- OPC_GATE_HOST={server-ip} (tried with localhost as well)
- OPC_GATE_PORT=7766
- OPC_HOST=localhost
- OPC_MODE=dcom
- OPC_SERVER=Matrikon.OPC.Simulation
- Create inbound outbound rule for port 7766 (tried with turned off firewall as well)
- Download and install openopc2 via pip under 32 bit version of Python in miniconda3
- Run python -m openopc2 list-servers in miniconda shell and got
- [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
- install OPC Core Components Redistributable (x64) 3.00.107
- Restart windows server
- Delete previous installed OpenOPCService and uninstall gbda_aut.dll
- Download OpenOPCService from https://github.com/iterativ/openopc2/releases/tag/0.1.11 and put it to Program Files
- Install and start service OpenOPCService
- Copy 64 bit version of gbda_aut.dll to System32
- Got to System32 and run regsvr32 gbda_aut.dll
- Setup env variables
- OPC_CLASS=OPC.Automation
- OPC_CLIENT=OpenOPC
- OPC_GATE_HOST={server-ip}
- OPC_GATE_PORT=7766
- OPC_HOST=localhost
- OPC_MODE=dcom
- OPC_SERVER=Matrikon.OPC.Simulation
- Create inbound outbound rule for port 7766 (tried with turned off firewall as well)
- Download OpenOPCCli from https://github.com/iterativ/openopc2/releases/tag/0.1.11 and put it to Program Files
- Run openopcCLI server-info
- Got
- OPCError: (OPCError(...), 'Dispatch: (-2147221164, 'Class not registered', None, None) opc_class:"OPC.Automation"') [13832] Failed to execute script 'cli' due to unhandled exception!