我有一个关于C# .NET命令行应用程序的问题,主要是使用COM对象从其他程序获取数据。当手动执行或在Node.js服务器内作为子进程运行时,它可以正常工作。但是,当整个项目安装为Windows服务时,C#应用程序会响应以下错误:
System.UnauthorizedAccessException: Creating an instance of the COM component with CLSID {D64DB4A9-3B26-4D2B-B556-9DA433C54175} from the IClassFactory failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
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)
at CurrentCamUri.Program.Main(String[] args)
据我所读的类似主题如这里,主要集中于Office应用程序,我应该看到"DCOM Config"选项卡内的COM对象在
dcomcnfg /32
中。但是,我无法找到与相关CLSID有关的任何内容。我尝试运行没有'/32'后缀的dcomcnfg
也没有成功。我需要从中获取数据的主要应用程序是32位的(让我们称其为“母应用程序”)。您有什么建议可以解决这个问题吗?非常感谢!