COMException:没有注册类别(REGDB_E_CLASSNOTREG)

异常信息:

发生了 System.Runtime.InteropServices.COMException
  Message="没有注册类别 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))"
  Source="ControlEase.OpcClient"
  ErrorCode=-2147221164
  StackTrace:
       在 Opc.IOPCServerList.GetClassDetails(Guid& clsid, String& ppszProgID, String& ppszUserType)
       在 Opc.OpcServerBrowser.ListAll(Guid catid, OpcServerInfo[]& serverslist, String nodeName)
  InnerException:

异常发生在枚举本机所有OPC2.0服务器的时候。

ifList.GetClassDetails( ref tempList[ i ].ClsID,
                            out tempList[ i ].ProgID, out tempList[ i ].ServerName )

其中ClsID的值为:a05bb6d5-2f8a-11d1-9bb0-080009d01446

运行regedit打开注册表编辑器,Ctrl+F搜索:a05bb6d5-2f8a-11d1-9bb0-080009d01446

结果显示如图:

因为之前卸载过RSLinx OPC Server,故报错。

原文地址:https://www.cnblogs.com/gmth/p/2987714.html