Kenny's Two Pennies

...and that's just about what it's worth
  Home |  Contact |   |  Login

Why does it have to be so hard?

I just spent a whole day trying to figure out why I was getting the infamous "ActiveX component can't create object" error. Grrrrrr.

I wrote an COM object in c#. I followed all of the rules. I was able to late-bind to it and use it in vb6. It is a really simple COM object with just one method that returns the string "yep". I plan on getting more fancy with it later.

I figured since VB6 worked, I could access it from a classic ASP page.  Wrong.

Well, first, I have a 64-bit laptop running Vista. No, I'm not going to bash Vista. I actually don't mind it at all. Except the 64-bit part -- seems I'm always having to make adjustments because of something I happen to be doing in 32-bit mode. The fact is, the majority of code out there is still 32-bit.

Here is how my easter-egg hunt went:

  1. Write the COM object. That was a piece of cake.
  2. Write a a classic ASP page to call the COM object. Another piece of cake.
  3. Run the ASP page. Oops. Can't do that within Visual Studio 2008. Cassini doesn't do classic ASP
  4. Found out that Vista Home Premium has IIS, but you have to install it. Well, ok. done.
  5. Why does Microsoft have to keep rearranging the furniture. The IIS 7 UI is way different that IIS 6.
  6. Finally got to run my asp page. Got the ActiveX component can't create object error.
  7. Why Microsoft can't give more details than that completely amazes me. Found numerous google results of people with this problem, and responses of "try this", "try that". Well, I would know EXACTLY what to try if I know specifically what the dang problem is.
  8. Is my COM object ok? Wrote a VB6 app to instantiate and use it. No problem.
  9. Is it an IIS problem? Wrote a .vbs script, it also gets the error. Interesting.
  10. Went thru many detours. Including downloading and installing Microsoft's Debugging Tools For Windows. That looks interesting, if I only knew how to use it.
  11. Found this link. Interesting! The cscript utility has a syswow64 compatibility version. That worked! Am I on to something?
  12. Went into IIS, DefaultAppPool, changed advanced-option "Enable 32-bit applications" to true. Still no go. Actually it turns out that this is a necessary step, but not the only one. Again, WHY couldn't the error message say that the problem had to do with running the app in 64-bit mode? Huh? Huh? And WHY was it defaulted to false? When most apps are still 32-bit?
  13. Went back into IIS, DefaultAppPool, changed "Identity" from NetworkService to LocalSystem. WOOHOO! it worked. It was a permissions problem. Nice to know. Couldn't Microsoft tell me that in the first place?

Bottom line: Persistence pays off, but at the expense of hair loss.

And: Informative error messages would be nice. Not these terse, cryptic, useless ones like "ActiveX component can't create object". Come-on -- can't the largest operating system company in the world do better than that?

Print | posted on Saturday, May 16, 2009 2:34 PM |

Comments have been closed on this topic.