'80040154 Class not registered' with inter

2019-01-26 08:23发布

问题:

I'm receiving the following error on a Windows XP Pro SP2 x64 machine running IIS6:

System.Runtime.InteropServices.COMException: 
Retrieving the COM class factory for component with CLSID
{3C250CBD-6CC9-11D2-9457-00004B48467E} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

This occurs when trying to instantiate a COM interop object.

Oddly enough, this works fine from a console application running under the same account as the application pool (a user in AD). I.e. both use UserX, so it doesn't seem like an obvious permissions issue.

Anyone else had anything similar?

回答1:

Make sure that your application pool is either 32 bit (or supports 32 bit apps) or your COM control supports 64 bit apps. Most likely, your native COM library is 32bit and your pool runs a 64 bit worker by default, which is unable to load 32bit COM dll.



回答2:

if running under IIS, is it really using "UserX", or is it using "Guest", "ASP.NET", or "IWAM_USER" or similar other account. Also, if its being invoked from IIS, you might need to check permissions... not just at the file level, but at the machine's COM configuration level.

Last time I had to deal with this, I would do

START -> RUN -> DCOMCNFG

or just bring up component services.

Then expand Component Services -> Computers -> My Computer -> DCOM Config and then scroll down to the COM object you are trying to use. Right click on it and there are multiple abs... Identity is the one that it will be launched as.. you can override this to put in a specific user to "bypass" the assumed "default". For TESTING ONLY, I would set it up with a less restrictive account (power user, not necessarily an admin, but try that last), and see if that helps.

In addition, on the Security tab, there are options for who can Launch/Activate and who can "Access" it. you might need to make sure your account is valid within that.