
[英]System.Runtime.InteropServices.COMException (0x80040154)
[英]Invoke-Command to remote machine leads to COMException (0x80040154)
我有一个使用COM的C#.NET应用程序。
当我在本地调用应用程序(machine1)时,将按需创建COM对象。
当我使用另一台计算机(machine2)远程启动应用程序时
Invoke-Command -Session $session -ScriptBlock {path\theapp.exe}
应用程序启动(当然是在machine1上),但是无法绑定COM对象:
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {C4DBE1C1-0608-48DF-AD9D-F34284FE7040} 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, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
我不明白这是怎么可能的-因为如果在本地启动执行,COM连接会起作用,为什么运行时以后会发现该类未注册?
感谢您的任何提示和指示!
问题解决了。
原因是(1)组件的调试/发行版不匹配,以及(2)不应以服务方式运行的另一个组件。
感谢您的阅读和发布!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.