QueryInterface for interface comFileFuncs._clsFileFuncs failed in ASP.NET.

A

adiel_g

Hello, I have created a activeX dll in vb6 that contains some functions
I am using in .NET. I created the dll in vb6 with:

Instancing = 5-Multiuse
MTSTransactionMode = 2-RequiresTransaction
Persistable = 0-NotPersistable

I then created a COM+ application, set the user to an admin in the COM+
settings and added the dll above as a component. Then from ASP.NET, I
added a reference to the dll created above. Everything was fine (on my
machine), I was able to use the functions from the dll in ASP.NET. I
then proceeded to register the vb6 dll and create the COM+ application
on a test server. When I go to test the functions of the dll from
ASP.NET I received this message:

QueryInterface for interface comFileFuncs._clsFileFuncs failed

After much testing I decided to create a VB.NET WinForm and see if that
would also fail in the test server. It did not fail! So basically
this is where it works and does not work:

My Machine (Windows 2000 SP4, .NET FRAMEWORK 1.0)
==========
ASP.NET = dll functions work
VB.NET WINFORM dll functions work

Test Machine (Windows 2000 SP4, .NET FRAMEWORK 1.0)
==========
ASP.NET = dll functions DO NOT work, receiving the QueryInterface
failed message
VB.NET WINFORM dll functions work

Any ideas why it is failing just in ASP.NET and just from that one
machine? What setting did I overlook? I also tried the
AspCompat="true" page directive with no difference.

Thanks before hand,
Adiel
 
A

adiel_g

Ok everyone problem solved. The solution when calling these vb6 COM+
objects is to use late binding (using the "Object" keyword) instead of
early binding. Here is how you do it:

Early Binding (Does not work all the time in .NET :) )
======================================================
Dim objFileFuncs As comFileFuncs.clsFileFuncs
objFileFuncs = New comFileFuncs.clsFileFuncs()

Late Binding (Works in .NET!)
=============================
Dim objFileFuncs As Object
objFileFuncs = New comFileFuncs.clsFileFuncs()

You might have a slight performance degredation but, in the long run,
these com+ objects will be obselete so I would not worry about it.

Thanks,
Adiel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top