all groups > dotnet remoting > may 2004 >
You're in the

dotnet remoting

group:

How do I use a COM+ component from a remote .NET client


How do I use a COM+ component from a remote .NET client Charlie
5/30/2004 11:36:55 AM
dotnet remoting:
First the background:

Business Objects (.NET)
I have a series of business objects (stateless .NET classes) written to
provide our products core functionality. We are trying to expose these
business objects such that end-users can write code using their prefered
language. A requirement is that the client has to be able to write code in a
scriptable language (VBScript, VB).


Component Services (COM+)
To meet this requirement, we wrote wrapper classes for each business object
into an assembly and placed it in Component Services and from there
generated a client proxy for client installation. On the client machine, I
install this generated MSI and now I can use the business objects from a
remote machine using VB script or Visual Basic.


Back to .NET
Now, what if another client wanted to connect to the serviced component
using .NET on the client side. I can't just add a reference to the COM+
component's type library because TlbImp cannot generate a .NET wrapper for a
type library generated from a CLR assembly. That means that for this to work
I need to use reflection or type cast the remote object to IDispatch and
make IDispatch calls (yuck). If I choose to use reflection, the CLR insists
on having the remote assembly locally to achieve the reflection before
making the remote invokation.

Now finally, here's the question:
Is there an easier way access exposed API via COM+ from a .NET client?

Thanks in advance,
Charlie

Re: How do I use a COM+ component from a remote .NET client Charlie
5/31/2004 4:05:06 PM
Thanks for your prompt response!

Yes the component is a series of classes in an assembly that each implement
System.EnterpriseServices.ServicedComponent and yes, I will need to use the
components (let's call this the "business objects") from a remote machine.
Please note that I can already access the business objects from a remote
machine by using VBScript or Visual Basic (i.e., IDispatch is working
perfectly - I even get the objects and interfaces that are exposed
indirectly).

I can also access the business objects from a .NET component on a remote
machine using reflection. The problem is that for this to work I have had to
put the 'business object' assembly on the client machine (for reflection
purposes - reflection occurs before making the invokation). What I am trying
to do is make these calls w/o having to put this assembly on the client
machine. Is this possible?

I did not understand what you meant by "by setting up a virtual directory,
adding a <system.runtime.remoting> section to it with the appropriate
definitions for your COM+ assembly (ServicedComponent)".

Why would I need a virtual directory? Are you suggesting I set up COM+ Web
Services, we would prefer using just straight COM+ (the same mechanism used
by VBScript).

Thanks again,
Charlie

"Paul Glavich [MVP - ASP.NET]" <glav@aspalliance.com-NOSPAM> wrote in
message news:ebenRGxREHA.1644@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: How do I use a COM+ component from a remote .NET client Paul Glavich [MVP - ASP.NET]
5/31/2004 11:17:01 PM
If you just want to access the components locally, then just reference the
..Net project or assembly, whichever one you have.

If you want to access the .Net object via COM+, then it depends how you have
written a wrapper class. Is it an assembly that simply inherits from
ServicedComponent? If this is the case, again simply reference the
assembly/project and you are away.

If you want to access this component remotely from another machine, then you
can provide a simple remoting entry point for the assembly by setting up a
virtual directory, adding a <system.runtime.remoting> section to it with the
appropriate definitions for your COM+ assembly (ServicedComponent), and
again you should be ok.

Not sure if that answers your question exactly though.

--
- Paul Glavich
Microsoft MVP - ASP.NET


[quoted text, click to view]

Re: How do I use a COM+ component from a remote .NET client (sameer_k_in NO[at]SPAM yahoo.com)
6/17/2004 4:58:21 AM
I'm also facing the same problem, i.e. accesing C# component hosted on COM+ from remote client using C#.
Can any one help me or guide me .

Thanks
Sameer

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Re: How do I use a COM+ component from a remote .NET client Paul Glavich [MVP - ASP.NET]
6/17/2004 11:02:33 PM
Either create a .Net component on the server and expose it via remoting (or
a web service if you want) that accesses the COM+ component, or export the
COM+ component from COM+ to create an installation for a proxy to the
component. Install the proxy on the client and access it like a COM
component (not the most efficient way of doing it, but it will work)

--
- Paul Glavich
Microsoft MVP - ASP.NET


[quoted text, click to view]
ASP.NET resources...

AddThis Social Bookmark Button