.Net Advertising as DCOM

  • Thread starter Thread starter Paul van't Klooster
  • Start date Start date
P

Paul van't Klooster

Hi,

I have a situation where I need to register a COM/COM+ object that I have
written in C# as DCOM.

I have no problems creating COM or COM+ classes using C#, but I have not
been successful in trying to create a class that is accessible through DCOM.

Is anyone able to help me with this one.

Thanks
Paul
 
Paul said:
Hi,

I have a situation where I need to register a COM/COM+ object that I have
written in C# as DCOM.

I have no problems creating COM or COM+ classes using C#, but I have not
been successful in trying to create a class that is accessible through
DCOM.

Is anyone able to help me with this one.

Thanks
Paul

DCOM ?

You should be using Web Services 2.0
 
Perhaps you could give an example of a component you've created and the
exact problems you've been had attempting to access it through DCOM.
 
Benjamin Disraeli said:
DCOM ?

You should be using Web Services 2.0

Actually Web Services is probably not what Paul wants. His desire to use
DCOM implies that he wants to be able to access objects on a remote machine
which Web Services cannot do. The .NET specific technology that may be an
alternative would be Remoting.
 
Yeah, i was trying to create an object for a legacy application who's
scripting language can only access DCOM objects, so remoting is not really
an option either.

Thanks for your help though.

Paul
 
The main problem that I am having is that after registering the COM+ object,
I cannot seem to see it in the list of objects that is being displayed when
you run DCOMCNFG.

I am developing this object for a third party, and they say that I must be
able to see it in DCOMCNFG for them to be able to use it, the sample code is
below:

using System;
using System.Runtime.InteropServices;
using System.EnterpriseServices;

[assembly: AssemblyTitle("ComDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\comkey.snk")]
[assembly: AssemblyKeyName("")]
[assembly: ApplicationName("ComDemo")]
[assembly: Description("A coms demo")]
[assembly: ApplicationActivation(ActivationOption.Server)]

namespace ComDemo
{

public interface IComDemo
{
void AddItem(int iIn, ref String sOut, ref int iOut, ref int
iResult);
}

/// <summary>
/// Summary description for Class1.
/// </summary>
public class ComDemo : ServicedComponent
{
public void AddItem(int iIn, ref String sOut, ref int iOut, ref int
iResult)
{
sOut = "Bob the builder";
iOut = iIn++;
iResult = 6401;
}

}
}

Once compiled, i use the regsvcs util to register it with COM+.

Thanks for your help.

Paul

Rob Windsor said:
Perhaps you could give an example of a component you've created and the
exact problems you've been had attempting to access it through DCOM.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada


Paul van't Klooster said:
Hi,

I have a situation where I need to register a COM/COM+ object that I have
written in C# as DCOM.

I have no problems creating COM or COM+ classes using C#, but I have not
been successful in trying to create a class that is accessible through DCOM.

Is anyone able to help me with this one.

Thanks
Paul
 
In you project properties under Configuration Properties|Build make sure
that Register for COM Interop is checked or use the regasm command line
utility to do the same manually.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada


Paul van't Klooster said:
The main problem that I am having is that after registering the COM+ object,
I cannot seem to see it in the list of objects that is being displayed when
you run DCOMCNFG.

I am developing this object for a third party, and they say that I must be
able to see it in DCOMCNFG for them to be able to use it, the sample code is
below:

using System;
using System.Runtime.InteropServices;
using System.EnterpriseServices;

[assembly: AssemblyTitle("ComDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\comkey.snk")]
[assembly: AssemblyKeyName("")]
[assembly: ApplicationName("ComDemo")]
[assembly: Description("A coms demo")]
[assembly: ApplicationActivation(ActivationOption.Server)]

namespace ComDemo
{

public interface IComDemo
{
void AddItem(int iIn, ref String sOut, ref int iOut, ref int
iResult);
}

/// <summary>
/// Summary description for Class1.
/// </summary>
public class ComDemo : ServicedComponent
{
public void AddItem(int iIn, ref String sOut, ref int iOut, ref int
iResult)
{
sOut = "Bob the builder";
iOut = iIn++;
iResult = 6401;
}

}
}

Once compiled, i use the regsvcs util to register it with COM+.

Thanks for your help.

Paul

Rob Windsor said:
Perhaps you could give an example of a component you've created and the
exact problems you've been had attempting to access it through DCOM.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada


Paul van't Klooster said:
Hi,

I have a situation where I need to register a COM/COM+ object that I have
written in C# as DCOM.

I have no problems creating COM or COM+ classes using C#, but I have not
been successful in trying to create a class that is accessible through DCOM.

Is anyone able to help me with this one.

Thanks
Paul
 
Hi,
If you run type DCOMCnfg in cmd.exe on WXP or W2K3 it will start you
Component Services console (COM+). DCOMCnfg and COM+ administration consolle
are different thingies only on W2K (NT4 doesn't support for COM+).
DCOMCnfg's main purpose is to configure security and activation options for
DCOM outproc servers, COM+ components use Component Services console for
that matter.
If they say that they need it to be visible from DCOMCnfg for being
accessible through DCOM - tell them that they wrong. COM+ server application
does it very nice too. Following pseudocode should do it great:

[assembly: AssemblyKeyFile("..\\..\\KeyFile.snk")]
[assembly: ApplicationName("DCOMDemo")]
[assembly: ApplicationID("12345678-0123-4321-1234-0123456789AB")]
[assembly: ApplicationAccessControl(true)]
[assembly: ApplicationActivation(ActivationOption.Server)]

[GuidAttribute("01234567-0123-4321-1234-0123456789AB")]
public interface IDCOMDemo
{
[DispId(1)]
string SayHello(string Name);
}

[GuidAttribute("76543210-0123-4321-1234-0123456789AB")]
[ClassInterface(ClassInterfaceType.None)]
public class DCOMDemo: ServicedComponent, IDCOMDemo
{
string IDCOMDemo.SayHello(string Name) {
return "Hello " + Name;
}
};

-Valery.
http://www.harper.no/valery

DCOMCnfg is not necessary for only W. COM+ security is registered
Paul van't Klooster said:
The main problem that I am having is that after registering the COM+
object,
I cannot seem to see it in the list of objects that is being displayed
when
you run DCOMCNFG.

I am developing this object for a third party, and they say that I must be
able to see it in DCOMCNFG for them to be able to use it, the sample code
is
below:

using System;
using System.Runtime.InteropServices;
using System.EnterpriseServices;

[assembly: AssemblyTitle("ComDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\comkey.snk")]
[assembly: AssemblyKeyName("")]
[assembly: ApplicationName("ComDemo")]
[assembly: Description("A coms demo")]
[assembly: ApplicationActivation(ActivationOption.Server)]

namespace ComDemo
{

public interface IComDemo
{
void AddItem(int iIn, ref String sOut, ref int iOut, ref int
iResult);
}

/// <summary>
/// Summary description for Class1.
/// </summary>
public class ComDemo : ServicedComponent
{
public void AddItem(int iIn, ref String sOut, ref int iOut, ref int
iResult)
{
sOut = "Bob the builder";
iOut = iIn++;
iResult = 6401;
}

}
}

Once compiled, i use the regsvcs util to register it with COM+.

Thanks for your help.

Paul

Rob Windsor said:
Perhaps you could give an example of a component you've created and the
exact problems you've been had attempting to access it through DCOM.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada


Paul van't Klooster said:
Hi,

I have a situation where I need to register a COM/COM+ object that I have
written in C# as DCOM.

I have no problems creating COM or COM+ classes using C#, but I have
not
been successful in trying to create a class that is accessible through DCOM.

Is anyone able to help me with this one.

Thanks
Paul
 
Back
Top