Google Answers Logo
View Question
 
Q: Need help with C# COM Interop, creating a DCOM server ( No Answer,   0 Comments )
Question  
Subject: Need help with C# COM Interop, creating a DCOM server
Category: Computers > Programming
Asked by: ddolheguy-ga
List Price: $80.00
Posted: 10 Dec 2004 12:31 PST
Expires: 12 Dec 2004 02:14 PST
Question ID: 440988
Ok, I am in desperate need to get help in answering some questions in
regards to building a DCOM Server using C#.

I need to create a DCOM server using C#.NET, I realise that you first
need to create the managed code, attach interfaces and use the CCW
command line tool to add a COM wrapper to the assembly.

The server will be communicating with a DCOM client which I didn't
write, but I have all the documentation on what interfaces and methods
it uses.

Please keep in mind I have never written a COM object before.

The questions I have are as follows:

1.  What extra do I need to do to make the COM object into a DCOM object?

2.  Do I need to worry about IInterface or IDispatch? Or is this all
done by the CCW Wrapper?

3.  How do I generate the GUID for each interface? And do I need to
worry about the QueryInterface Interface which the client uses to find
out which interfaces are available?

4.  I found a basic COM Interop Server in C#, which just returns the
name of a person to the COM client as shown below. My guess is that I
just create the interfaces on the Server side COM object as the
documentation requests and then write my own code inside?

A DCOM Client and Server example would also be great if anyone has one
written in .NET (Any language would be fine, but prefer C# or VB.NET)


CODE:
-------------------------

using System;
using System.Runtime.InteropServices;
namespace CSharpServer
{
   // Since the .NET Framework interface and coclass have to behave as 
   // COM objects, we have to give them guids.
   [Guid("DBE0E8C4-1C61-41f3-B6­ A4-4E2F353D3D05"
   public interface IManagedInterface
   {
      int PrintHi(string name);
   }

   [Guid("C6659361-1625-4746-93­ 1C-36014B146679"
   public class InterfaceImplementation : IManagedInterface
   {
      public int PrintHi(string name)
      {
         Console.WriteLine("Hello, {0}!", name);
         return 33;
      }
   }
}
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy