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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prashanth Uppunda

    #1

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

    Hello,

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

    Thanks
    Prashanth
  • Peter Huang [MSFT]

    #2
    RE: How to create COM object in remote machine (DCOM server)

    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
    Microsoft Support is here to help you with Microsoft products. Find how-to articles, videos, and training for Microsoft Copilot, Microsoft 365, Windows 11, Surface, and more.


    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.t lb in the %systemroot%\sy stem32 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.C lass1 cls = new DCOMDemo_Svr1.C lass1Class();
    Console.WriteLi ne(cls.ServerTi me().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.
    --------------------[color=blue]
    >Content-Class: urn:content-classes:message
    >From: "Prashanth Uppunda" <Prashanth.Uppu nda@geind.ge.co m>
    >Sender: "Prashanth Uppunda" <Prashanth.Uppu nda@geind.ge.co m>
    >Subject: How to create COM object in remote machine (DCOM server)
    >Date: Mon, 1 Sep 2003 05:08:23 -0700
    >Lines: 7
    >Message-ID: <06a101c37081$b da7d1d0$a401280 a@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.publi c.dotnet.genera l
    >Path: cpmsftngxa06.ph x.gbl
    >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:106841
    >NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
    >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    >Hello,
    >
    >Does anybody have an idea on how to instantiate a DCOM
    >server residing in another machine using C#?
    >
    >Thanks
    >Prashanth
    >[/color]

    Comment

    Working...