Can't instantiate COM object from ASP.NET MVC app

隐身守侯 提交于 2019-12-13 00:24:33

问题


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?


回答1:


Set the Application Pool's Default User to a user with Admin rights




回答2:


@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.



来源:https://stackoverflow.com/questions/10471856/cant-instantiate-com-object-from-asp-net-mvc-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!