Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM and ASPX problem

Status
Not open for further replies.

bluebytez

Programmer
Dec 20, 2001
39
MY
Hi, I am trying to call a COM component from ASPX, but I keep getting an InvalidCastException, it seems that the QueryInterface for the object fails.
I wrote the dll in another machine and exported it using COM+ Services.
I've even tried to write a simple COM component which exposes only one public sub that does NOTHING, but the ASPX still can't seem to initialize the interface.
Can anyone shed any light on this ?
 
You must create a wrapper for your classic COM object to use it w/in the .NET framework. Be warned that you will lose much of your performance when you do so. Unless it's just an enormous component, the best practice is to completely re-write it using a managed provider.



hope that helps! :)
paul
penny1.gif
penny1.gif
 
ps -- to use the legacy component, you'll have to put this bit in your page directive:

aspCompat="True"
penny1.gif
penny1.gif
 
I agree with Link9 - you need to write a wrapper (VS.NET should do this for you when you set a reference to the COM object). But if the object is not huge, and especially if you're calling it alot, then you should re-write it as a managed component.

Another thing to think about is that VB6 components under COM+ are single-threaded, no matter what you set the options to. And another thing to think about is that COM+ objects that do database access automatically promote their isolation level to "serialized" (i.e. exclusive), thus locking everyone else out (even people just doing reads).

The more I hear about COM+, the less I like it. We've got a guy from Microsoft Premier Services in the office this week, and he's saying that MS itself is moving away from COM+.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top