奇怪System.Runtime.InteropServices.COMException错误
问题描述:
我有一个Windows Forms应用程序,我发表,并安装在我的服务器上,但是当我试图用它可悲的是给了我这个错误:奇怪System.Runtime.InteropServices.COMException错误
************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {40942A6C-1520-4132-BDF8-BDC1F71F547B} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at PDFtoDoc.Form1.DoOCR(String FullPath)
at PDFtoDoc.Form1.CheckFileAndDoOCR(String directoryPath)
at PDFtoDoc.Form1.timer1_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
这似乎是一个“.dll”文件丢失给我,但我无法弄清楚哪一个或者这是否是真正的问题。什么会造成这种情况?我该如何解决它?
答
这是COM Interop的问题。您需要手动将dll文件复制到应用程序或包dll文件到安装程序中。
+1
好,而不是手动复制,重新安装'微软图片Acquisition Library'更安全地解决了这个问题。感谢它现在解决的想法。 –
这个答案应该包括它: http://*.com/questions/8213894/using-interop-modi-throws-0x80040154-exception –