We have all seen the 80040154 COM error. Normally the solution is to run regsvr32 on the com dll so it is registered on the machine.
“System.Runtime.InteropServices.COMException (0×80040154): Retrieving the COM class factory for component with CLSID {D1CB0D81-7D2B-4064-9AC7-D0D88DEC3D16} failed due to the following error: 80040154.”
Of course regsvr32 was the first thing I did, but the error still happened in the ASP.Net MVC project on IIS7/ Server 2008. Using regedit.exe verified the dll was registered, so I ran the NUnit tests… same error! The solution is to permit the IIS7 App Pool to run 32 bit code as shown below:

IIS7 COM Gotcha
Hi Paul, I just wanted to thank you. I was having this problem at work and now i solved it. Thank you so much!!!!
Saludos desde Barranquilla, Colombia!!!
Thanks so much, i tried everything with registry regsvr32 and permissions and stuff. Now it worked, got me into some frustrating days
No problem, as IIS7 starts to roll out I imagine this will get a lot of hits from search engines as that is a nasty gotcha. Looking at my logs most people finding it today just have the plain jane regsvr32 issue
Thanks, worked for me.
This is not a solution–we need to run 64-bit code.
@EDS: You can still run 64 bit code as well, this fix is to permit 32 bit code in addition to 64 bit code.
I’ve trying to resolve this issue for a litle while now myself. I checked the same things you did and I’d love to try this solution, however that option is not in my Advanced Settings!
Any ideas?
nevermind – I’m running 32bit Vista, so not applicable.
..s.till searching for a solution.
Jon, did you try regsvr32? I’ll email you..
Had the same problem, after enabling 32bit apps on 64 bit 2008 server. Tried a restart the w3wp.exe service, but same problem. Restarted the entire server, and everything worked fine. We’ve experienced this on all our win 2008 servers. So try a restart (or find out what other services apart from WWW Publishing Service that needs restarting)
N. Gjermundshaug
Filemail.com
thank you thank you…
Thanks, This information helped me out a lot!
Dear Paul,
in my advanced settings I don’t have that option…I really tried to solve this problem, i did EVERYTHING, every single thing I found on net, but NOTHING worked. error 80040154 REALLY makes me angry. please,please,help me…
thanks a lot.. greeting from croatia =)
Anita, you might want to try asking on StackOverflow.com
What about 32 bit servers?
The solution you mention works for some cases where you are running a 64bit server and want to use a (32bit) ADO provider. However, what if you get this error on a 32bit server?
We are getting this error on a 32bit machine. We used regsvr to register the provider and it works, however, the issue keeps reappearing. Any known issues that may cause the regsvr registration to get lost?
I cannot be very helpful at this time, but do remember having that issue years ago with a COM object. Why it happened is not coming to mind, if it does I’ll email you
Muchas gracias hermano me salvaste la vida… ya no me sale el error pero ahora tengo el problema de conectarme al SQL Server 2008 no puedo conectar ya que la conexion esta dentro del DLL en VB6.
Desde peru muchas gracias
Julio, glad to help – good luck with the connection string. As a quick hack maybe just hex edit the dll? It might be in plaintext
I looked for about an hour to figure this out with no luck, my problem was I was looking to the vendor of the dll and they had nothing. Worked perfect thank you!
Thanks for leaving the comment Matt. Only a small percentage of people leave comments but this page receives a lot of traffic from search engines. I bet it has saved man-months of time.
Thanks a lot ! Great ! Saved my project !
Paul, I’m using IIS 6.0. How can I fix this issue? Thanks
@Norbs: This post won’t help with IIS6 at all. You are probably hitting the common regsvr32 issue. i.e. you just need to register the COM object – there many posts out there that cover this
I can’t tell you how much time I put in to trying to resolve this to no avail. Everything worked fine in the ASP.NET Visual Web Developer 2010 Web Development Server, Cassini, but I got the Com Component not registered error when publishing to IIS 7 on my remote Windows 2008 x64 box. THANK YOU!!!!!
This was a bear. Totally threw me this AM. I KNEW the vb comm interop I was given to use was registered because it would work when testing in Cassini. I only started getting this wierd error when I tried testing in IIS7 on the same workstation. I figured it was a permission problem, and didn’t even consider the bit issue. Thanks for the solution, you saved me a lot of time trying to figure this out.
Thanks so much, this is an invaluable piece of knowledge.
[...] j0rd4n I found the solution. Many forum posts suggested it was a permissions issue. However, this link revealed it was an AppPool issue. It turns out, you have to configure the application pool to allow [...]
Paul, this information was a lifesaver! I had a COM DLL working great from a desktop app I was using to test, but my asp.net app completely refused to load it, offering instead its 80040154 apologies. I’ve been wrestling with this for a day and a half before stumbling onto this blog and solving my problem in about 3 minutes.
Thank You!
Thank you, Thank you, Thank you… I’ve had a very stressful day on this problem.
i just wanted to say thank you sooo much
this issue had me going in circles for two whole days. now it’s fixed.
i kept getting COM component errors which did not help in troubleshooting the problem.
i’m using windows 7.. and vs2008. I couldn’t find an option to enable 32-bit applications! Do you know any other way around?
It’s there in Win7; I was playing with a few weeks ago to solve an Oracle ODP.Net issue