C# OPC Client fails to get server list

Demir picture Demir · Aug 14, 2013 · Viewed 9.2k times · Source

After I compiled my C# in my new Windows 8 64-Bit machine, I started to get the following error while getting list of available servers in my OPC client application.

"OpcNetApi.Com Unable to cast COM object of type 'System.__ComObject' to interface type 'OpcRcw.Comn.IOPCServerList2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{9DD0B56C-AD9E-43EE-8305-487F3188BF7A}' failed due to the following error: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

What could be the reason?

Answer

Camille G. picture Camille G. · Aug 14, 2013

Quoted from the OPC.NET readme :

The .NET COM interop assemblies are built against the 32-bit versions of the proxy/stubs. This means that any .NET application running on x64 systems must be compiled and run as a 32-bit application