Frage

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?

War es hilfreich?

Lösung

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

Andere Tipps

Hi: To solve this problem install OPC .NET API OPC .NET API 2.00 Redistributables 105.1 and then install OPC Core Components Redistributable (x64) 105.1. With this you can connect to OPC Server runing in 32 bits fom client running on 64 bit.

And don't foget, that Redistributables (OPC .NET API OPC .NET API 2.00 Redistributables, OPC Core Components Redistributables) and libraries (OpcNetApi.dll, OpcNetApi.Com.dll, OpcNetApi.Xml.dll...) referenced in your project must be the same versions.

i think the only problem is you are trying to connect to remote machine with different user and password you must create your current user in remote machine same as local machine username and password then you must configure on remote machine "component services"->Console root->Component Services->Computers->Dcom config->OpcEnum setting and give access to this user in Properties -> Security my problem solved by this way good luck

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top