Geeks With Blogs
The Reluctant Blogger Blogging not because I have to, but because I want to

If you’re like me, you don’t really do a lot with COM components these days.  For me, I’ve been ‘lucky’ to stay in the managed world for the past 6 or 7 years.

Until last week.

I’m running a project to upgrade a web interface to an older COM-based application.  The old web interface is all classic ASP and lots of tables, in-line styles and a bunch of other late 90’s and early 2000’s goodies.  So in addition to updating the UI to be more modern looking and responsive, I decided to give the server side an update, too.  So I built some COM-InterOp DLL’s (easily through VS2012’s Add Reference feature…nothing new here) and built a test console line app to make sure the COM DLL’s were actually built according to the COM spec.  There’s a document management system that I’m thinking of whose COM DLLs were not proper COM DLLs and crashed and burned every time .NET tried to call them through a COM-InterOp layer.

Anyway, my test app worked like a champ and I felt confident that I could build a nice façade around the COM DLL’s and wrap some functionality internally and only expose to my users/clients what they really needed.

So I did this, built some tests and also built a test web app to make sure everything worked great.  It did.  It ran fine in IIS Express via Visual Studio 2012, and the timings were very close to the pure Classic ASP calls, so there wasn’t much overhead involved going through the COM-InterOp layer.

You know where this is going, don’t you?

So I deployed my test app to a DEV server running IIS 7.5.  When I went to my first test page that called the COM-InterOp layer, I got this pretty message:

Retrieving the COM class factory for component with CLSID {81C08CAE-1453-11D4-BEBC-00500457076D} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

It worked as a console app and while running under IIS Express, so it must be permissions, right?  I gave every account I could think of all sorts of COM+ rights and nothing, nada, zilch!

Then I came across this question on Experts Exchange, and at the bottom of the page, someone mentioned that the app pool should be running to allow 32-bit apps to run.  Oh yeah, my machine is 64-bit; these COM DLL’s I’m using are old and are definitely 32-bit.  I didn’t check for that and didn’t even think about that.  But I went ahead and looked at the app pool that my web site was running under and what did I see?  Yep, select your app pool in IIS 7.x, click on Advanced Settings and check for “Enable 32-bit Applications”.

image

I went ahead and set it to True and my test application suddenly worked.

Hope this helps somebody out there from pulling out your hair.

Posted on Monday, June 17, 2013 3:36 PM C# , COM-InterOp , Integration | Back to top


Comments on this post: IIS 7’s Sneaky Secret to Get COM-InterOp to Run

# re: IIS 7’s Sneaky Secret to Get COM-InterOp to Run
Requesting Gravatar...
I just had this exact problem & your post was the solution. Thank you for taking the time to post this!!
Left by Jennifer Fazler on Jul 11, 2013 10:12 AM

# re: IIS 7’s Sneaky Secret to Get COM-InterOp to Run
Requesting Gravatar...
in IIS 6 my application working fine ,but in ii7 always i am getting application crash issue during file conversion.
Left by muthu on Jun 26, 2014 2:18 PM

# re: IIS 7’s Sneaky Secret to Get COM-InterOp to Run
Requesting Gravatar...
application pool stopped when enable 32 apps in set to true.
Left by thanjo on Mar 10, 2015 4:27 AM

Your comment:
 (will show your gravatar)


Copyright © David Hoerster | Powered by: GeeksWithBlogs.net