|
Home > Archive > IIS ASP > June 2006 > error '80131509'
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Jason Rowland 2004-10-19, 2:48 am |
| 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")
%>
| |
| Aaron [SQL Server MVP] 2004-10-19, 7:50 am |
| 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" <JasonRowland@discussions.microsoft.com> wrote in message
news:0190289D-F0E5-4F46-810D-660B538889B1@microsoft.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")
> %>
| |
| Aaron [SQL Server MVP] 2004-10-19, 7:50 am |
| 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" <JasonRowland@discussions.microsoft.com> wrote in message
news:0190289D-F0E5-4F46-810D-660B538889B1@microsoft.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")
> %>
| |
| Jason Rowland 2004-10-19, 5:51 pm |
| 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" <JasonRowland@discussions.microsoft.com> wrote in message
> news:0190289D-F0E5-4F46-810D-660B538889B1@microsoft.com...
> create
> CreateObject("ComTest.WebFarmSession")
>
>
>
| |
| bseddon 2006-06-17, 1:28 pm |
|
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
------------------------------------------------------------------------
|
|
|
|
|