473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

trying to add class library dll to COM+ component package

i have a c# class library that is being compiled with the "Register for
COM Interop" flag set to "True." it compiles just fine. however, when i
go into the Component Services administrative tool and attempt to add
the .dll to an application, i get the following message:

"One or more files do not contain components or type libraries. These
components cannot be installed."

i'm sure there's a step i'm missing, so how do i alter what i'm doing
so that i can access my class library through a COM interface model
(i.e. in ASP classic)

thanks for any help

jason

Nov 17 '05 #1
5 8324

"jason" <ia****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
i have a c# class library that is being compiled with the "Register for
COM Interop" flag set to "True." it compiles just fine. however, when i
go into the Component Services administrative tool and attempt to add
the .dll to an application, i get the following message:

"One or more files do not contain components or type libraries. These
components cannot be installed."

i'm sure there's a step i'm missing, so how do i alter what i'm doing
so that i can access my class library through a COM interface model
(i.e. in ASP classic)

thanks for any help

jason


..NET types need to derive from ServicedComponent and be registered using
regsvcs.exe - Check this chapter "Writing Serviced Components" in the
Framework developers guide.

Willy.


Nov 17 '05 #2
thanks so much willy, that's all it took. the class is now deriving
form ServicedComponent. i also added strong naming, and the class
library registers in the COM+ utility just fine.

but i have one more question if you don't mind.

the class library has a base class which derives from
ServicedComponent. that baseclass has a public abstract method, like
the following example:

using System.EnterpriseServices;

namespace MyNS
{
public abstract class MyBaseClass : ServicedComponent
{
public MyBaseClass () { }
public abstract bool MyAbstractMethod (int nValue);
}
}

and a sample derived class might look like the following example:

namespace MyNS
{
public class MyClass : MyBaseClass
{
public MyClass() { }
public string MyString = "Hi";
public override bool MyAbstractMethod(int nValue)
{
if (nValue == 1) return true;
return false;
}
}
}

however when i instantiate this object in the COM environment of
classic ASP code, like follows:

dim oWebsite, bReturn
set oMyClass = Server.CreateObject("MyNS.MyClass")
Response.Write(oMyClass.MyString)
bReturn = oMyClass.MyAbstractMethod(1)

the instantiation works fine, the Response.Write of MyString works
fine, but when i try to access that override method, i get the
following message:

Invalid procedure call or argument: 'MyAbstractMethod'

is there something special you have to do to abstract methods to expose
them in serviced components?

thanks again,

jason

Nov 17 '05 #3

"jason" <ia****@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
thanks so much willy, that's all it took. the class is now deriving
form ServicedComponent. i also added strong naming, and the class
library registers in the COM+ utility just fine.

but i have one more question if you don't mind.

the class library has a base class which derives from
ServicedComponent. that baseclass has a public abstract method, like
the following example:

using System.EnterpriseServices;

namespace MyNS
{
public abstract class MyBaseClass : ServicedComponent
{
public MyBaseClass () { }
public abstract bool MyAbstractMethod (int nValue);
}
}

and a sample derived class might look like the following example:

namespace MyNS
{
public class MyClass : MyBaseClass
{
public MyClass() { }
public string MyString = "Hi";
public override bool MyAbstractMethod(int nValue)
{
if (nValue == 1) return true;
return false;
}
}
}

however when i instantiate this object in the COM environment of
classic ASP code, like follows:

dim oWebsite, bReturn
set oMyClass = Server.CreateObject("MyNS.MyClass")
Response.Write(oMyClass.MyString)
bReturn = oMyClass.MyAbstractMethod(1)

the instantiation works fine, the Response.Write of MyString works
fine, but when i try to access that override method, i get the
following message:

Invalid procedure call or argument: 'MyAbstractMethod'

is there something special you have to do to abstract methods to expose
them in serviced components?

thanks again,

jason


Should work. Can you try using this simple script?

' test.vbs
Set x = Wscript.CreateObject("MyNS.MyClass")
Wscript.Echo x.MyAbstractMethod(10)

Willy.
Nov 17 '05 #4
i will definitely give it a shot as soon as i figure out how to use
this COM+ MMC. i created an application in COM+ to host the dll
specifically so that the file could be unlocked without having to
reboot the server, but it seems to be locked anyway, after disabling
the application in the COM+ MMC. so once i figure out how to get COM+
to work like it should, i'll give that script a try and post back the
results. thanks,

jason

Nov 17 '05 #5
you're right, that DID work. so i took a closer look at the function
that isn't working, here is the actual (non-example) function
signature:

public override bool LoadByID(int nID, SqlConnection oConn)

i'm guessing the problem is with the second parameter, SqlConnection
oConn. this class library was originally built to work with ASP.NET
pages, but some pages are still in ASP classic. the data type of the
database connection that the classic pages create are of course not
SqlConnection. i'm not even sure if that's a class that CAN be
instantiated through COM.

i will try to see if i can instantiate an SqlConnection object in ASP
classic. failing that, i will have to just create a backward compatible
set of methods that work with the standard ADO object set. thanks for
walking through this with me.

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: syd | last post by:
In my project, I've got dozens of similar classes with hundreds of description variables in each. In my illustrative example below, I have a Library class that contains a list of Nation classes. ...
6
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at...
3
by: Ian | last post by:
The beginning of my assembly that I am getting the access error from looks like this. ********************************* Imports System.EnterpriseServices Imports System Imports...
7
by: TJ | last post by:
In C# how do you achieve pass-by-reference property declarations in the Type Library? I am writing a COM Class Library that must mimick an existing library for which the only information is the...
6
by: ryan.d.rembaum | last post by:
Hello, I have code that I wish to use in many web applications. Basically sort of stand utility stuff. So from Visual Studio Project I select add a component and chose Component Class. Lets...
1
by: Jim | last post by:
Have fully operational software package developed on VB.NET that worked until Jan 1 2003, with early stage deployments on Oct 10, Oct 23, Nov 11, Dec 12 and Dec 30. When attempted final...
5
by: Ram | last post by:
Hi Friends I want to develope a custom control in .net which can be used with any project. I am writing a function in that class which I want to take any object as parameter. For that I have...
1
by: Ezmeralda | last post by:
Hello, I need to an TCP/IP Interface for communication with an embedded device. Since I have two different design ideas in mind, I am wondering whether you could give me some hints to decide:...
7
by: Christiano Donke | last post by:
Is there a way to do this without having to register it computer-by-computer??? tried everything already... but nothign worked out as should.. tks..
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.