When I try to create a instance of a COM class it throws an exception as
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Please suggest how could i solve it?
When I try to create a instance of a COM class it throws an exception as
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Please suggest how could i solve it?
In my case the class was registered properly and built in ANY CPU / 64 bit mode.
But the Enable 32-bit Applications property of the IIS Application pool of the application which uses the class was set to True.
Class was not found because of the architecture mismatch between the application pool configuration and the actual registered class.
Setting Enable 32-bit Applications to False fixed the issue.

I have faced the same issue when we tried to upgrade our application from .NET framework 3.5 to v4.7.2.
In my case, everything mentioned above (targeting architecture to x86, registering COM DLLs, were already done)
The only thing worked for me is recreating interop DLL by running tlbimp command with latest .NET framework (in my case it was v4.7.2) and then use this DLL to rebuild the project. That solved it.
I have faced the same issue. After done some research i found fix for me and it may useful. The issue is not only related to re-installation as of my observation, it depends on access permissions also.
Step 1: Repair the particular COM object.
Step 2: Component Services > Computers > My Computer > DCOM Config > Select your COM object > Right click > Properties > Security tab > Access Permissions > Choose Customize > Click EDIT > Select IIS_USER (If not exists create with complete rights) and give complete access and click OK.
Move to Identity tab > You can select "Interactive user" or "This user" > Click Apply and OK. If you choose "This user", we have to give Administrative privileged user to that server
Step 3: Open IIS Manager > Restart the Application Pools.
Note: If required please restart the server