By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

How to create COM object in remote machine (DCOM server)

P: n/a
Hello,

Does anybody have an idea on how to instantiate a DCOM
server residing in another machine using C#?

Thanks
Prashanth
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Prashanth,

I think the method of consuming the DCOM service is similar with what you
do in legacy VB6 or C/C++.

1.Please follow the Knowledge Base (KB) link to make a DCOM server.(As a
demonstration, I made the DCOM server using VB6)
266717 HOWTO: Create a DCOM Client/Server Application by Using Visual Basic
http://support.microsoft.com/?id=266717

2. You may need to register the DCOM Server in where your client lies. The
easiest method is to use the PDW addin shipped with VB6 to package the DCOM
server.
[Note: You do not need to package the DCOM exe file, because it will run on
the server, but you need to include the DCOM .tlb and .vbr files, so that
the install program can register the DCOM server on the client for you. You
can do this in the "Included Files" step when you package the DCOM server
using PDW.

3. In VS.NET IDE create a simple Console project and make reference to the
.tlb by "Add reference dialog/COM" dialog[In my demo, it will be
DCOMDemo_Svr1.tlb in the %systemroot%\system32 directory. Below is my demo
code to consume a DCOM server in a remote server.

using System;
using DCOMDemo_Svr1;
public class RemoteConnect
{
public static void Main()
{
DCOMDemo_Svr1.Class1 cls = new DCOMDemo_Svr1.Class1Class();
Console.WriteLine(cls.ServerTime().ToString());
}
}

You may perform the steps and let me know if this does the job for you.
If you have further questions about this issue, please feel free to let me
know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
Content-Class: urn:content-classes:message
From: "Prashanth Uppunda" <Pr***************@geind.ge.com>
Sender: "Prashanth Uppunda" <Pr***************@geind.ge.com>
Subject: How to create COM object in remote machine (DCOM server)
Date: Mon, 1 Sep 2003 05:08:23 -0700
Lines: 7
Message-ID: <06****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcNwgb2no/+14eV3Rq6/njOZVCG9Hw==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.dotnet.general
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:106841
NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
X-Tomcat-NG: microsoft.public.dotnet.general

Hello,

Does anybody have an idea on how to instantiate a DCOM
server residing in another machine using C#?

Thanks
Prashanth


Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.