By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

2.0- VB.NET Interop Issue

P: n/a
Long story longer, I'm tearing my hair out trying to get some of my
assemblies to work in ASP/COM. I have 4 classes/assemblies:

#1. CustomerMembershipProvider (Inherits MembershipProvider)
#2. CustomTcpClient (Inherits TcpClient)
#3. ASPFormsAuthentication (does magic to read/write
FormsAuthenticationTickets in ASP 3.0)
#4. ASPMembership (does magic to use Membership API within ASP 3.0)

Now, all of these assemblies are set to "Make assembly COM-Visable" and
"Register for COM Interop". Everything build and registers just fine.
Now, from with ASP, I can Server.CreateObject #3 and #4.
Server.CreateObject for #1 and #2 simply yield me:
Server object error 'ASP 0177 : 80131509'
Server.CreateObject Failed
/Default.asp, line 35
80131509


While the ASPMembership class can be created under COM, the minute it
trys to return a CustomMembershipProvider from itself, the page also
bails with the same error above.

Now, after some tinkering, I noticed the common ground here is that #1
and #2 Inherit something else while #3 and #4 don't.

Clearly there is some COM Interop/InteropServices/Inferace magic I'm
missing. What do I have to do to get these things expoed to COM and
actually working?

It is just the fact that the auto generated iterop stuff doesn't guess
correctly, and I should build and interface for those classes that
inherit other things so .NET knows what to expose?

-=Chris

Jan 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Christopher H. Laco wrote:
Long story longer, I'm tearing my hair out trying to get some of my
assemblies to work in ASP/COM. I have 4 classes/assemblies:

#1. CustomerMembershipProvider (Inherits MembershipProvider)
#2. CustomTcpClient (Inherits TcpClient)
#3. ASPFormsAuthentication (does magic to read/write
FormsAuthenticationTickets in ASP 3.0)
#4. ASPMembership (does magic to use Membership API within ASP 3.0)

Now, all of these assemblies are set to "Make assembly COM-Visable" and
"Register for COM Interop". Everything build and registers just fine.
Now, from with ASP, I can Server.CreateObject #3 and #4.
Server.CreateObject for #1 and #2 simply yield me:
Server object error 'ASP 0177 : 80131509'
Server.CreateObject Failed
/Default.asp, line 35
80131509


While the ASPMembership class can be created under COM, the minute it
trys to return a CustomMembershipProvider from itself, the page also
bails with the same error above.

Now, after some tinkering, I noticed the common ground here is that #1
and #2 Inherit something else while #3 and #4 don't.

Clearly there is some COM Interop/InteropServices/Inferace magic I'm
missing. What do I have to do to get these things expoed to COM and
actually working?

It is just the fact that the auto generated iterop stuff doesn't guess
correctly, and I should build and interface for those classes that
inherit other things so .NET knows what to expose?

-=Chris


For the curious, I've solved this problem (I think).
The key was that all classes that failed Inherited something else. THat
meant a lot of guessing for regasm when generating the typelib.

I created a custom interface for the classes in question. Then I set the
ComDefaultInterface attribute to use the custom interface. Whola. No
more guessing and it works from ASP/COM.

There's probably something in the massive docs about this type of
scenerio, but it would be nice if Interop docs basically said this is
preferred practice on and class that inherits from another...

-=Chris
Jan 16 '06 #2

P: n/a
Christopher,

Thanks a million for posting this solution, we have been working late nights
for a week to get our site upgraded to ASP.Net 2.0 and this helped us solve
our last showstopper issue at the 11th hour.

Max Lancaster
Senior Developer
The Motley Fool
www.fool.com

"Christopher H. Laco" wrote:
Christopher H. Laco wrote:
Long story longer, I'm tearing my hair out trying to get some of my
assemblies to work in ASP/COM. I have 4 classes/assemblies:

#1. CustomerMembershipProvider (Inherits MembershipProvider)
#2. CustomTcpClient (Inherits TcpClient)
#3. ASPFormsAuthentication (does magic to read/write
FormsAuthenticationTickets in ASP 3.0)
#4. ASPMembership (does magic to use Membership API within ASP 3.0)

Now, all of these assemblies are set to "Make assembly COM-Visable" and
"Register for COM Interop". Everything build and registers just fine.
Now, from with ASP, I can Server.CreateObject #3 and #4.
Server.CreateObject for #1 and #2 simply yield me:
Server object error 'ASP 0177 : 80131509'
Server.CreateObject Failed
/Default.asp, line 35
80131509


While the ASPMembership class can be created under COM, the minute it
trys to return a CustomMembershipProvider from itself, the page also
bails with the same error above.

Now, after some tinkering, I noticed the common ground here is that #1
and #2 Inherit something else while #3 and #4 don't.

Clearly there is some COM Interop/InteropServices/Inferace magic I'm
missing. What do I have to do to get these things expoed to COM and
actually working?

It is just the fact that the auto generated iterop stuff doesn't guess
correctly, and I should build and interface for those classes that
inherit other things so .NET knows what to expose?

-=Chris


For the curious, I've solved this problem (I think).
The key was that all classes that failed Inherited something else. THat
meant a lot of guessing for regasm when generating the typelib.

I created a custom interface for the classes in question. Then I set the
ComDefaultInterface attribute to use the custom interface. Whola. No
more guessing and it works from ASP/COM.

There's probably something in the massive docs about this type of
scenerio, but it would be nice if Interop docs basically said this is
preferred practice on and class that inherits from another...

-=Chris

Jan 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.