C# “类未注册(来自 HRESULT 的异常:0x80040154 (REGDB_E_CLASSNOTREG))”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11077477/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
提问by user1462809
I am trying to use an application, the application is working fine, i am trying to edit the existing item in the application. while clicking the edit am getting the following error,
我正在尝试使用一个应用程序,该应用程序工作正常,我正在尝试编辑应用程序中的现有项目。单击编辑时出现以下错误,
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:
Its with the Dll file that i have used with my application. i have tried to registered this dll file using regsvr32 but i cant make it.
它与我在我的应用程序中使用的 Dll 文件一起使用。我曾尝试使用 regsvr32 注册此 dll 文件,但我无法注册。
DLL:AxInterop.DHTMLEDLib.dll & Interop.DHTMLEDLib.dll
Any one have idea on this exception?
有人对这个例外有想法吗?
回答by Ruslan
This is probably not a solution to your problem, but a suggestion just in case (I know I ran into a similar problem before but not with a .NET application).
这可能不是您问题的解决方案,而是以防万一的建议(我知道我以前遇到过类似的问题,但在 .NET 应用程序中没有遇到过)。
If you are on a 64-bit machine, there are 2regsvr32.exefiles;
One is in \Windows\System32and the other one is in \Windows\SysWOW64.
如果您使用的是 64 位机器,则有2 个regsvr32.exe文件;一个在\Windows\System32,另一个在\Windows\SysWOW64。
You cannot register 64-bit COM-objects with the 32-bit version, but you can do it vice versa. I'd try registering your DLL with both regsvr32.exefiles explicitly (i.e. typing "C:\Windows\System32\regsvr32.exe /i mydll.dll" and then "C:\Windows\SysWOW64\regsvr32.exe /i mydll.dll") and seeing if that helps...
您不能用 32 位版本注册 64 位 COM 对象,但反之亦然。我会尝试使用这两个regsvr32.exe文件显式注册您的 DLL (即输入“ C:\Windows\System32\regsvr32.exe /i mydll.dll”然后输入“ C:\Windows\SysWOW64\regsvr32.exe /i mydll.dll”),看看是否有帮助...
回答by Jacob Seleznev
You'd need to register DHTMLED.ocx
你需要注册 DHTMLED.ocx
回答by Bloodmoon
What is the target platform of your application? I think you should set the platform to x86, do not set it to Any CPU.
您的应用程序的目标平台是什么?我认为您应该将平台设置为x86,不要将其设置为Any CPU.
回答by Aitizazk
I got the same error with vlc component when i changed the framework from 4.5 to 4. but it worked for me when I changed the platform from Any CPU to x86.
当我将框架从 4.5 更改为 4 时,vlc 组件出现了相同的错误。但是当我将平台从 Any CPU 更改为 x86 时,它对我有用。
回答by Alex Jolig
[HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
[HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Just looking at the message it sounds like one or more of the components that you reference, or one or more of their dependencies is not registered properly.
仅查看消息,听起来您引用的一个或多个组件,或者它们的一个或多个依赖项未正确注册。
If you know which component it is you can use regsvr32.exe to register it, just open a command prompt, go to the directory where the component is and type regsvr32 filename.dll (assuming it's a dll), if it works, try to run the code again otherwise come back here with the error.
如果你知道它是哪个组件你可以使用regsvr32.exe来注册它,只需打开一个命令提示符,进入组件所在的目录并输入regsvr32 filename.dll(假设它是一个dll),如果它有效,请尝试再次运行代码,否则返回错误。
If you don't know which component it is, try re-installing/repairing the GIS software (I assume you've installed some GIS software that includes the component you're trying to use).
如果您不知道它是哪个组件,请尝试重新安装/修复 GIS 软件(我假设您已经安装了一些包含您尝试使用的组件的 GIS 软件)。
回答by Arvigeus
Something I stumbled upon today for a DLL I knew was working fine with my VS2013 project, but not with VS2015:
我今天偶然发现了一个 DLL,我知道它在我的 VS2013 项目中运行良好,但不适用于 VS2015:
Go to: Project -> XXXX Properties -> Build -> Uncheck "Prefer 32-bit"
去: Project -> XXXX Properties -> Build -> Uncheck "Prefer 32-bit"
This answer is way overdue and probably won't do any good, but if you. But I hope this will help somebody someday.
这个答案已经过期了,可能不会有任何好处,但如果你。但我希望有一天这会对某人有所帮助。
回答by Rahul R G
After a sequence of attempts I came into a facile solution. You can try Reinstalling ActiveX plugin for Adobe flashplayer.
经过一系列的尝试,我找到了一个简单的解决方案。您可以尝试为 Adobe flashplayer 重新安装 ActiveX 插件。
回答by jbooker
My fix was to create Platform in configuration manager in visual studio, and set to x64
我的解决方法是在 Visual Studio 的配置管理器中创建平台,并设置为 x64
回答by Mohammad Towhidul Islam
open cmd as Administrator then try to register in both location
以管理员身份打开 cmd 然后尝试在两个位置注册

