“类未注册(HRESULT 的例外:0x80040154 (REGDB_E_CLASSNOTREG))”

本文关键字:0x80040154 REGDB CLASSNOTREG 注册 类未注册 HRESULT | 更新日期: 2023-09-27 18:37:27

我正在尝试使用应用程序,应用程序工作正常,我正在尝试编辑应用程序中的现有项目。 单击编辑时出现以下错误,

System.Runtime.InteropServices.COMException was unhandled
  Message="Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
  Source="System.Windows.Forms"
  ErrorCode=-2147221164
  StackTrace:
       at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
       at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
       at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
       at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
       at System.Windows.Forms.AxHost.CreateInstance()
       at System.Windows.Forms.AxHost.GetOcxCreate()
       at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
       at System.Windows.Forms.AxHost.CreateHandle()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.AxHost.EndInit()
       at bulk_lister.frm_edititem.InitializeComponent() in New Bulklister'new bulklister'bulk_lister'bulk_lister'frm_edititem.designer.cs:line 4248
       at bulk_lister.frm_edititem..ctor(Int32 userid, Int32 intListingId) in New Bulklister'new bulklister'bulk_lister'bulk_lister'frm_edititem.cs:line 187
       at bulk_lister.parent_form.funEditItem_fromrghtclktoolStrip_edititm() in New Bulklister'new bulklister'bulk_lister'bulk_lister'parent_form.cs:line 1313
       at bulk_lister.parent_form.rghtclktoolStrip_edititm_Click(Object sender, EventArgs e) in New Bulklister'new bulklister'bulk_lister'bulk_lister'parent_form.cs:line 1233
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at bulk_lister.Program.Main() inNew Bulklister'new bulklister'bulk_lister'bulk_lister'Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

它与我与我的应用程序一起使用的 Dll 文件。 我尝试使用 Regsvr32 注册此 DLL 文件,但我无法做到。

DLL:AxInterop.DHTMLEDLib.dll & Interop.DHTMLEDLib.dll

有人知道这个例外吗?

“类未注册(HRESULT 的例外:0x80040154 (REGDB_E_CLASSNOTREG))”

应用程序的目标平台是什么?我认为您应该将平台设置为x86,不要将其设置为Any CPU

这可能不是您问题的解决方案,而是一个以防万一的建议(我知道我以前遇到过类似的问题,但没有使用 .NET 应用程序)。

如果您在 64 位计算机上,则有 2regsvr32.exe文件;一个是'Windows'System32 另一个在'Windows'SysWOW64.

不能使用 32 位版本注册 64 位 COM 对象,但反之亦然。我会尝试使用两个regsvr32.exe文件显式注册您的 DLL(即键入" C:'Windows'System32'regsvr32.exe /i mydll.dll",然后键入" C:'Windows'SysWOW64'regsvr32.exe /i mydll.dll "),看看是否有帮助......

当我将框架从 4.5 更改为 4 时,我在 vlc 组件上遇到了同样的错误。但是当我将平台从任何 CPU 更改为 x86 时,它对我有用。

我今天偶然发现了一个DLL,我知道我的VS2013项目工作正常,但VS2015却不能:

前往: Project -> XXXX Properties -> Build -> Uncheck "Prefer 32-bit"

这个答案早就应该了,可能不会有任何好处,但如果你。但我希望有一天这会帮助某人。

我的解决方法是在Visual Studio的配置管理器中创建平台,并设置为x64

[HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

仅查看消息,听起来像您引用的一个或多个组件,或者它们的一个或多个依赖项未正确注册。

如果您知道它是哪个组件,则可以使用 regsvr32.exe 来注册它,只需打开命令提示符,转到组件所在的目录并键入 regsvr32 文件名.dll(假设它是一个 dll),如果它有效,请尝试再次运行代码,否则返回此处并出现错误。

如果您不知道它是哪个组件,请尝试重新安装/修复 GIS 软件(我假设您已经安装了一些包含您尝试使用的组件的 GIS 软件)。

您需要注册 DHTMLED.ocx

经过一系列尝试,我得出了一个简单的解决方案。您可以尝试重新安装 Adobe flashplayer 的 ActiveX 插件。

管理员身份打开cmd,然后尝试在两个位置注册