Getting error "Cannot create ActiveX component" even after registering the COM component in registry

0

I have a windows service written in c#.This service is hosted in Windows Server 2016.
This service does some calculations for every equal intervals of time.To do this calculaton, it opens a application in the background called AutoCal, which is a COM component.
The application is installed in the server and its dll is added as a reference in the service.

First the machine had version V4.1. I have wrriten the following code to open the application .

(AutoCal.Application)Interaction.CreateObject("AutoCal.Application.NewInstance")

It used to open in the background and worked perfectly as expected. Now the application version is upgraded to V4.2 and uninstalled the old version.

When I run the same service , it is giving an exception saying :

Cannot create ActiveX component.

After searching about it, I changed the above code of line to this to see if it works :

(AutoCal.Application)Activator.CreateInstance(Type.GetTypeFromProgID("AutoCal.Application.NewInstance"))

But this is giving an entirely different error as below.

Retrieving the COM class factory for component with CLSID {xxxxxx-xxxxx-xxxxxx-xxxxxxx} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))

I have searched for this error and confirmed that the new v4.2 is registered or not.I observed that only V4.1 i registered in registry at location :

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\CompanyName\AutoCal\V4.1.

So I have registered V4.2 as well using : cd windows\SysWOW64 --> regsvr32 "Path of .ocx file"

Even then , it was giving the error.

Also , I have tried building the window service code X86 instead of AnyCPU and deployed in the server, since AutoCal application is also a 32 bit application. But that didn't work either.

Is there anything else I'm missing for this to work.Any help in this regard is very much helpful.Thanks.

PS : Server is 64 bit machine, AutoCal is 32 bit application, in case this info is useful.

c#
com
activex
asked on Stack Overflow Jan 19, 2020 by CrazyCoder • edited Jan 20, 2020 by CrazyCoder

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0