As the title says, I want to instantiate a COM object from an ASP.NET MVC app like this:
dynamic obj = Activator.CreateInstance(Type.GetTypeFromProgID(progID));
but it throws the following ComException:
Retrieving the COM class factory for component with CLSID {16542E4F-4594-4B97-922D-BE9C478F93BB} failed due to the following error: 800aea5f Exception from HRESULT: 0x800AEA5F.
The same code works from a Winforms app with the following build configuration: Platform: x86
and Platform target: x86
.
I set the build configuration the same as the Winforms app for both the mvc app and the assembly where I use the COM object.
I'm using Windows 7, IIS 7.5, ASP.NET v4.0 Application Pool with Enable 32-Bit Applications True and the website runs under a user with Administator rights.
What are your suggestions to help solve this problem?
Set the Application Pool's Default User to a user with Admin rights
@david.s I don't know how to add a screenshot as a comment, so I set it as an answer. As you already have all 32bit stuff set and the DLL can't be called it might be a permission problem.
Call dcomcnfg.exe and check the settings (sorry, only german server, but should work):
You have to reset your IIS after settings change.