469,366 Members | 1,822 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

error '80131509'

I created a .NET assembly and made it accessable as a COM object. When I
tried to instantiate it in an ASP page, I got error '80131509'. If I create
the COM object in a simple HTML page it works fine. I am using ASP, not
ASP.NET. Searching for the number on google gives no help whatsoever.

This is the ASP that I am using:
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim WebFarmSession: WebFarmSession = CreateObject("ComTest.WebFarmSession")
%>
Jul 21 '05 #1
4 12500
How are you "creating the COM object in a simple HTML page"? Is it a
control that the user will see? Otherwise, what purpose could it serve in
HTML?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Jason Rowland" <Ja**********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
I created a .NET assembly and made it accessable as a COM object. When I
tried to instantiate it in an ASP page, I got error '80131509'. If I create the COM object in a simple HTML page it works fine. I am using ASP, not
ASP.NET. Searching for the number on google gives no help whatsoever.

This is the ASP that I am using:
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim WebFarmSession: WebFarmSession = CreateObject("ComTest.WebFarmSession") %>

Jul 21 '05 #2
How are you "creating the COM object in a simple HTML page"? Is it a
control that the user will see? Otherwise, what purpose could it serve in
HTML?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Jason Rowland" <Ja**********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
I created a .NET assembly and made it accessable as a COM object. When I
tried to instantiate it in an ASP page, I got error '80131509'. If I create the COM object in a simple HTML page it works fine. I am using ASP, not
ASP.NET. Searching for the number on google gives no help whatsoever.

This is the ASP that I am using:
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim WebFarmSession: WebFarmSession = CreateObject("ComTest.WebFarmSession") %>

Jul 21 '05 #3
I am creating it on the HTML page just to test that my .NET COM object was
working properly (it was).
dim myobj
set myobj = CreateObject("ComTest.WebFarmSession")
myobj.testmethod()

When I moved the code to an ASP page to use it server side where it will be
used, I got the error. The error message "error 80131509" that is returned
is extremely unhelpful. The problem is I don't know ASP as all my experience
is .NET, java. Instead of the code that worked for me in the html file, I
needed to use:

set WebFarmSession = Server.CreateObject("ComTest.WebFarmSession")

If you omit the "Server." prefix, you get that error.

"Aaron [SQL Server MVP]" wrote:
How are you "creating the COM object in a simple HTML page"? Is it a
control that the user will see? Otherwise, what purpose could it serve in
HTML?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Jason Rowland" <Ja**********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
I created a .NET assembly and made it accessable as a COM object. When I
tried to instantiate it in an ASP page, I got error '80131509'. If I

create
the COM object in a simple HTML page it works fine. I am using ASP, not
ASP.NET. Searching for the number on google gives no help whatsoever.

This is the ASP that I am using:
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim WebFarmSession: WebFarmSession =

CreateObject("ComTest.WebFarmSession")
%>


Jul 21 '05 #4

Jason Rowland wrote:
[b]I created a .NET assembly and made it accessable as a COM object.
When I
tried to instantiate it in an ASP page, I got error '80131509'.


This reply is being posted (two years too late) because I ran into the
80131509 problem and this post is the most frequently presented by
Google in response to this error number. However the thread doesn't
(didn't) contain an answer. Having spent two hours cracking the
problems, others might save a bit of time knowing an answer.

Like Jason I have a .NET (C# as it turns out) assembly that exposes a
class as a COM object. When used from an Excel add-in (written in VB)
the class works. But if the COM class exposed by the assembly is
instantiated from a .vbs script or even a VB program an 80131509 error
is raised. When I put message boxes in the class constructor I could
see that the constructor runs successfully but that the error is raised
after - so reason suggests that it was not a code problem.

After stripping out ALL the code, the only slightly unusual thing left
was that the exposed class inherits from a base class. Because I don't
want the base class exposed to COM it was decorated with
[ComVisible(false)]. When I finally removed this decoration from the
base class the COM class worked in VB and in scripts.

So it seems mscorlib does not want to expose a .NET class to COM if
it's base class is not visible. My lesson is that classes which are to
be exposed should not inherit. They should single classes that delegate
to a contained instance of the class that really does the work.

--
bseddon
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jun 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tony Wright | last post: by
7 posts views Thread by p | last post: by
5 posts views Thread by yashu0209 | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.