473,396 Members | 1,834 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.

Creating COM server with C#

m.a
Hello,

Where can I find detail information about how I can create a COM server
with C#? Is there any tutorial or any book in this subject?

I am using MSVC 2005 professional or MSVC 2008 express.

Thanks


Jun 27 '08 #1
6 1069
You cannot AFAIK write a native COM server in C#.

What you *can* do is write a "serviced component" (i.e. a COM+ dll that
you can host as a COM+ application in "Component Services".

http://msdn.microsoft.com/en-us/library/ty17dz7h.aspx

Alternatively, you can use a COM-server compatible framework to write a
shim COM server to the managed (.NET) COM library (dll); for
quick'n'dirty jobs I've used VB6 for this; or C++ if you are literate
with it (I'm not very...).

Marc
Jun 27 '08 #2
m.a

"Marc Gravell" <ma**********@gmail.comwrote in message
news:ep**************@TK2MSFTNGP06.phx.gbl...
You cannot AFAIK write a native COM server in C#.

What you *can* do is write a "serviced component" (i.e. a COM+ dll that
you can host as a COM+ application in "Component Services".

http://msdn.microsoft.com/en-us/library/ty17dz7h.aspx

Alternatively, you can use a COM-server compatible framework to write a
shim COM server to the managed (.NET) COM library (dll); for quick'n'dirty
jobs I've used VB6 for this; or C++ if you are literate with it (I'm not
very...).

Marc

Thanks Marc,
What is the difference between COM and COM+? I want to use my COM in
matlab. Can I write COM+?

Regards
Jun 27 '08 #3
In many simple cases, not a huge amount - you're simply piggy-backing
off COM+'s ability to host a library in a host exe as a service. But
COM+ has support for a lot of things like transaction support (think:
DTC / TransactionScope). You don't have to use them, though.

As for matlab, no idea; but the point is that COM+ acts as the COM
server. So it might be wroth a try with a quick test project (just don't
write everything until you know the concept is sound).

Marc
Jun 27 '08 #4
m.a wrote:
"Marc Gravell" <ma**********@gmail.comwrote in message
news:ep**************@TK2MSFTNGP06.phx.gbl...
>You cannot AFAIK write a native COM server in C#.

What you *can* do is write a "serviced component" (i.e. a COM+ dll that
you can host as a COM+ application in "Component Services".

http://msdn.microsoft.com/en-us/library/ty17dz7h.aspx

Alternatively, you can use a COM-server compatible framework to write a
shim COM server to the managed (.NET) COM library (dll); for quick'n'dirty
jobs I've used VB6 for this; or C++ if you are literate with it (I'm not
very...).

Marc


Thanks Marc,
What is the difference between COM and COM+? I want to use my COM in
matlab. Can I write COM+?

Regards

It is pretty easy to expose interfaces as COM. You just need to decorate
the interface and or its methods with [ComVisible(true)] following is an
example interface.
[ComVisible(true)]
public interface ITypeDefinition : IDisposable
{
/// <summary>
/// Get the name of this type
/// </summary>
String TypeName{get;}
}

Once you have the assembly built you can use the regasm tool to register it.

Use help on ComVisible and regasm to find out the details. You might
check www.codeproject.com for examples. I find most everything I have
questions about has some sort of example there.

Hope that helps.
Leon Lambert
Jun 27 '08 #5
Yes, exposing as COM is tricky - but exposing as a COM *server* (exe) as
opposed to a COM *library* (dll) is the tricky bit.

Of course, it is entirely possible that the OP hasn't used "server" as a
technical term, but simply means "COM", in which case a library should
work fine.

Marc
Jun 27 '08 #6
Of course - maybe I am using the term incorrectly ;-p

I'll use different terms...

If you just need a callable COM object, then yes, it is easy. If you
need it to be out-of-process, then it is harder.

Marc
Jun 27 '08 #7

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

Similar topics

0
by: Robert | last post by:
I get these errors when creating a asp .net web application project in VS 2003 on a remote web server: "Microsoft Development Environment The Web was created successfully, but an error occurred...
8
by: mcmg | last post by:
Hi, I have an asp app that works fine on a windows xp machine but does not work on a windows 2000 server. I have the following code in my global.asa: <OBJECT RUNAT=Server SCOPE=SESSION...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
7
by: mike | last post by:
Hi, I am having difficulty in creating a thread using pthread_create. It seems that pthread_create does not execute 'program', and returns -1; I have checked the API but I am not sure why this...
6
by: Eran Kampf | last post by:
I am trying to dynamically create directories in my ASP.NET application (I am using Server.MapPath("/")+"test" as the folder) and I am getting a DirectoryNotFoundException saying "Could not find a...
3
by: Ken Varn | last post by:
I am just starting the process of creating ASP.NET server controls. I have created controls for .NET applications, but have just started with ASP.NET. I am a little confused about some areas that...
6
by: Jerry Spence1 | last post by:
Why doesn't the following work in my ASP program? I have imported ADOX I am trying to create a temporary database on the user's PC. The example is taken from Microsoft. Dim cat As Catalog =...
0
by: Peter D. Dunlap | last post by:
I have a number of web sites on my 2003 server, each of the independent sites (i.e., not subdirectories of the localhost site). The way I have always set these up in the past is: 1. Create a...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
2
by: astolpho | last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output: ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.