Error description E = {"Unable to cast COM object of type" System.__comobject "to interface type ' OpcRcw.Da.IOPCServer". This operation failed because of a COM component call to an interface with IID ' {39c13a4d-011e-11d0-9675-0020afd8adb3} ' QueryInterface failed with the following error: No class was registered (exception from hresult:0 x80040154 (Regdb_e_classnotreg)). "} or cannot cast a COM object of type" System.__comobject "to the interface type" HaiGrang.Package.OpcNetApiChs.DaInterface.IOPCServer ". This operation failed because of a COM component call to an interface with IID ' {39c13a4d-011e-11d0-9675-0020afd8adb3} ' QueryInterface failed with the following error: No class was registered (exception from hresult:0 x80040154 (Regdb_e_classnotreg)).
Causes and workarounds under 64-bit systems, some components (Microsoft) have only 32-bit versions, and 64-bit applications do not call 32-bit COM components, and the result is that there is no registered category. In 64-bit systems, VS2008 generates 64-bit programs by default, and you can change the program's deployment platform to x86 to generate 32-bit programs. Workaround: In the "solution"-"Development project name", right-click on "Properties"-"build"-"target platform", "AnyCPU" to "x86", recompile the program.
Original website: http://blog.csdn.net/w88193363/article/details/7497300
A COM object of type ' system.__comobject cannot be cast to an interface type because there is no registered class