2017-05-16 11 views
-1

ノードからCOMオブジェクトにアクセスする方法を教えてください。NodeJSからCOMオブジェクトにアクセスする方法

私は既にEdgeとC#を使用した単純なDLLを使用して実装を試しています。呼び出し関数を呼び出すと、すべてがDLLで正常に機能しますが、DLLは指定されたCOMオブジェクトを見つけることができません。しかし、同じVS Solutionでテストプログラムを構築してそこから実行すると、うまく動作します。だからここ

は私のコード(それはちょうどタイプである前に、それは、私のコードでCOMオブジェクトの最初の実際の使用です)です:

using QBXMLRP2Lib; 
... 
try { rp = new RequestProcessor2(); } catch (Exception e) { return e } 

そしてそれは、このエラーを返します。

{ Error: Retrieving the COM class factory for component with CLSID {45F5708E-3B43-4FA8-BE7E-A5F1849214CB} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). 
    at Error (native) 
    ErrorCode: -2147221164, 
    Message: 'Retrieving the COM class factory for component with CLSID {45F5708E-3B43-4FA8-BE7E-A5F1849214CB} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).', 
    Data: {}, 
    InnerException: null, 
    TargetSite: {}, 
    StackTrace: 
    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, StackCrawlMark& stackMark) 
    at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
    at System.Activator.CreateInstance(Type type) 
    at Startup.DoQBQuery(Object options) in c:\path\to\my\source\code\Startup.cs:line 35 
    HelpLink: null, 
    Source: 'mscorlib', 
    HResult: -2147221164, 
    message: 'Retrieving the COM class factory for component with CLSID {45F5708E-3B43-4FA8-BE7E-A5F1849214CB} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).', 
    name: 'System.Runtime.InteropServices.COMException' } 
+0

登録の問題です。 regasm/codebaseにCOMオブジェクトを登録しましたか?また、x86/x64の不一致が原因である可能性があります。 –

+0

ハァー、それが問題でした。私は64ビットノードを使い、QB XMLライブラリは32ビットです。それを答えに入れるためのケア? –

答えて

0

0x80040154またはREGDB_E_CLASSNOTREG "クラスが登録されていません"というエラーは、COMオブジェクト登録の問題を示す非常に一般的なエラーです。 COMは基本的にあなたが探しているオブジェクトを見つけることができないことを伝えます。

今日の世界では、ほとんどの場合、x86/x64の不一致があります。クライアントとサーバー(インプロセスDLLの場合)は同じビット数でコンパイルされません。

.NETを.DLL(インプロセスサーバー)として使用している場合は、少なくとも開発/テスト段階でRegAsm /codebaseを使用して登録したことを確認する必要があります。

関連する問題