473,375 Members | 1,338 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,375 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 1068
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: ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.