Calling a .NET COM+ component from an ASP page.

  • Thread starter Thread starter Peter Rilling
  • Start date Start date
P

Peter Rilling

I created a COM+ component (ServicedComponent) in .NET. The component has a
single method Connect() which returns a reference to a SqlConnection object.
This component works fine when the world is centered around .NET. Now I
want this component to work when called from inside an ASP page.

I know that I can do this because I created a test component with a method
that returns a string (strings are simple to marshal). When I called the
Connect method, I get an internal server error from IIS. I was wondering if
this problem has to do with some marshalling issues or something else.
Since SqlConnect is a .NET class, would there be any problem with using it
in an ASP page? What might be causing my problem?
 
I am a little further along but still having problems.

Since I am using ASP and VBScript, there is concept of "types". I use the
CreateObject method to create an instance of the COM+ component. That
works. I run the following test and I get an "Object required" error.

Response.Write(myObj.C().ConnectionString)

What does the error mean. The following displays "false" so I know that I
am getting back a SqlConnection (also this is a small test component with
hardcoded values so as to rule our all other problems).

Response.Write(myObj.C() is nothing)

Now, I also have test methods A() and B() while return strings. Those work
correctly.

If I was in a strongly-typed language, I would say the problem is because
the object would need to be casted. However, there is no casting in
VBScript.

Any thoughts?
 
Back
Top